Submission #69686795
Source Code Expand
# from math import factorial as f
from functools import cache
T, MOD = map(int, input().split())
# https://stackoverflow.com/a/46378809/14853184
@cache
def multinomial(lst):
res, i = 1, 1
for a in lst:
for j in range(1,a+1):
res = ((res * i) // j)
i += 1
return res % MOD
def solve():
N = int(input())
nums = tuple(map(int, input().split()))
print(multinomial(nums))
for _ in range(T):
solve()
Submission Info
| Submission Time | |
|---|---|
| Task | E - Count Sequences 2 |
| User | Favo02 |
| Language | Python (PyPy 3.10-v7.3.12) |
| Score | 0 |
| Code Size | 482 Byte |
| Status | TLE |
| Exec Time | 2214 ms |
| Memory | 115176 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 450 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt, 01_test_33.txt, 01_test_34.txt, 01_test_35.txt, 01_test_36.txt, 01_test_37.txt, 01_test_38.txt, 01_test_39.txt, 01_test_40.txt, 01_test_41.txt, 01_test_42.txt, 01_test_43.txt, 01_test_44.txt, 01_test_45.txt, 01_test_46.txt, 01_test_47.txt, 01_test_48.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 77 ms | 80560 KiB |
| 00_sample_01.txt | AC | 85 ms | 82344 KiB |
| 01_test_00.txt | AC | 549 ms | 92136 KiB |
| 01_test_01.txt | TLE | 2211 ms | 86116 KiB |
| 01_test_02.txt | TLE | 2213 ms | 113932 KiB |
| 01_test_03.txt | AC | 501 ms | 92004 KiB |
| 01_test_04.txt | TLE | 2211 ms | 86636 KiB |
| 01_test_05.txt | TLE | 2213 ms | 114064 KiB |
| 01_test_06.txt | AC | 485 ms | 92480 KiB |
| 01_test_07.txt | TLE | 2211 ms | 87048 KiB |
| 01_test_08.txt | TLE | 2213 ms | 113680 KiB |
| 01_test_09.txt | AC | 512 ms | 91908 KiB |
| 01_test_10.txt | TLE | 2211 ms | 85712 KiB |
| 01_test_11.txt | TLE | 2213 ms | 113544 KiB |
| 01_test_12.txt | AC | 554 ms | 91536 KiB |
| 01_test_13.txt | TLE | 2211 ms | 86396 KiB |
| 01_test_14.txt | TLE | 2213 ms | 114692 KiB |
| 01_test_15.txt | AC | 487 ms | 92636 KiB |
| 01_test_16.txt | TLE | 2211 ms | 85904 KiB |
| 01_test_17.txt | TLE | 2213 ms | 114584 KiB |
| 01_test_18.txt | AC | 483 ms | 92036 KiB |
| 01_test_19.txt | TLE | 2211 ms | 87724 KiB |
| 01_test_20.txt | TLE | 2213 ms | 113292 KiB |
| 01_test_21.txt | AC | 474 ms | 91868 KiB |
| 01_test_22.txt | TLE | 2211 ms | 87096 KiB |
| 01_test_23.txt | TLE | 2213 ms | 114512 KiB |
| 01_test_24.txt | AC | 466 ms | 91924 KiB |
| 01_test_25.txt | TLE | 2211 ms | 86340 KiB |
| 01_test_26.txt | TLE | 2213 ms | 112812 KiB |
| 01_test_27.txt | AC | 520 ms | 92180 KiB |
| 01_test_28.txt | TLE | 2211 ms | 85864 KiB |
| 01_test_29.txt | TLE | 2213 ms | 114360 KiB |
| 01_test_30.txt | AC | 464 ms | 91804 KiB |
| 01_test_31.txt | TLE | 2211 ms | 86684 KiB |
| 01_test_32.txt | TLE | 2213 ms | 114080 KiB |
| 01_test_33.txt | AC | 539 ms | 92268 KiB |
| 01_test_34.txt | TLE | 2211 ms | 86204 KiB |
| 01_test_35.txt | TLE | 2214 ms | 114564 KiB |
| 01_test_36.txt | AC | 544 ms | 92632 KiB |
| 01_test_37.txt | TLE | 2211 ms | 86200 KiB |
| 01_test_38.txt | TLE | 2213 ms | 114560 KiB |
| 01_test_39.txt | AC | 538 ms | 91768 KiB |
| 01_test_40.txt | TLE | 2212 ms | 86588 KiB |
| 01_test_41.txt | TLE | 2213 ms | 114352 KiB |
| 01_test_42.txt | AC | 538 ms | 91816 KiB |
| 01_test_43.txt | TLE | 2211 ms | 85484 KiB |
| 01_test_44.txt | TLE | 2213 ms | 114656 KiB |
| 01_test_45.txt | AC | 535 ms | 92424 KiB |
| 01_test_46.txt | TLE | 2211 ms | 85664 KiB |
| 01_test_47.txt | TLE | 2213 ms | 115176 KiB |
| 01_test_48.txt | TLE | 2211 ms | 84896 KiB |