結果
問題 | No.1693 Invasion |
ユーザー | hydru |
提出日時 | 2021-10-01 21:57:12 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 484 bytes |
コンパイル時間 | 479 ms |
コンパイル使用メモリ | 87,028 KB |
実行使用メモリ | 135,960 KB |
最終ジャッジ日時 | 2023-09-26 17:12:08 |
合計ジャッジ時間 | 4,939 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
75,716 KB |
testcase_01 | AC | 74 ms
71,616 KB |
testcase_02 | AC | 89 ms
75,660 KB |
testcase_03 | AC | 82 ms
76,324 KB |
testcase_04 | AC | 74 ms
71,044 KB |
testcase_05 | AC | 105 ms
77,424 KB |
testcase_06 | AC | 107 ms
78,436 KB |
testcase_07 | AC | 133 ms
78,352 KB |
testcase_08 | AC | 97 ms
77,000 KB |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
ソースコード
from math import factorial def comb(n,r): return factorial(n) // (factorial(n - r) * factorial(r)) n,m=map(int,input().split()) A=list(map(int,input().split())) A.sort() inf=10**8+1 mod=998244353 DP=[inf]*(m+1) DP[0]=0 for j in range(0,m): for i in range(n): if j+A[i]<=m: DP[j+A[i]]=min(DP[j+A[i]],DP[j]+1) else: break ans=0 for i in range(m+1): if DP[i]==inf: continue ans=(ans+comb(m-DP[i],i-DP[i]))%mod print(ans)