結果
問題 | No.1693 Invasion |
ユーザー | eSeF |
提出日時 | 2021-08-08 01:52:05 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 663 bytes |
コンパイル時間 | 593 ms |
コンパイル使用メモリ | 10,840 KB |
実行使用メモリ | 17,680 KB |
最終ジャッジ日時 | 2023-09-26 15:36:26 |
合計ジャッジ時間 | 15,579 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
12,436 KB |
testcase_01 | AC | 15 ms
8,164 KB |
testcase_02 | AC | 16 ms
8,056 KB |
testcase_03 | AC | 18 ms
8,056 KB |
testcase_04 | AC | 16 ms
7,976 KB |
testcase_05 | AC | 22 ms
7,700 KB |
testcase_06 | AC | 21 ms
7,980 KB |
testcase_07 | AC | 21 ms
8,008 KB |
testcase_08 | AC | 22 ms
8,060 KB |
testcase_09 | TLE | - |
testcase_10 | AC | 1,378 ms
17,448 KB |
testcase_11 | AC | 445 ms
12,412 KB |
testcase_12 | AC | 1,708 ms
17,680 KB |
testcase_13 | AC | 794 ms
11,452 KB |
testcase_14 | AC | 1,092 ms
11,936 KB |
testcase_15 | AC | 613 ms
9,924 KB |
testcase_16 | AC | 1,495 ms
12,036 KB |
testcase_17 | AC | 15 ms
8,156 KB |
testcase_18 | TLE | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
ソースコード
N, M = map(int,input().split()) a = list(map(int,input().split())) INF = (1<<31) dp = [INF]*(M+1) dp[0] = 0 for i in range(M): for j in range(N): if i + a[j] <= M: dp[i+a[j]] = min(dp[i+a[j]],dp[i]+1) MOD = 998244353 fac = [1] for i in range(1,M+1): fac.append((fac[-1]*i)%MOD) faci = [pow(fac[-1],MOD-2,MOD)] for i in reversed(range(1,M+1)): faci.append((faci[-1]*i)%MOD) faci = list(reversed(faci)) def binom(n,r): if n < 0 or r < 0 or n < r: return 0 return (fac[n]*faci[r]*faci[n-r])%MOD ans = 0 for i in range(M+1): if dp[i] == INF: continue ans += binom(M-dp[i],i-dp[i]) ans%=MOD print(ans)