結果

問題 No.1693 Invasion
ユーザー hydruhydru
提出日時 2021-10-01 22:13:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 600 bytes
コンパイル時間 1,450 ms
コンパイル使用メモリ 86,796 KB
実行使用メモリ 87,552 KB
最終ジャッジ日時 2023-09-26 17:36:06
合計ジャッジ時間 6,838 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
76,932 KB
testcase_01 AC 104 ms
72,228 KB
testcase_02 AC 114 ms
76,208 KB
testcase_03 AC 115 ms
76,952 KB
testcase_04 AC 105 ms
72,444 KB
testcase_05 AC 116 ms
76,720 KB
testcase_06 AC 113 ms
76,972 KB
testcase_07 AC 125 ms
78,420 KB
testcase_08 AC 113 ms
76,984 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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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+cmb(m-DP[i],i-DP[i]))%mod
print(ans)
0