結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー H3PO4H3PO4
提出日時 2020-05-29 22:02:48
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 357 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 82,284 KB
実行使用メモリ 359,308 KB
最終ジャッジ日時 2024-04-23 22:27:59
合計ジャッジ時間 7,077 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,760 KB
testcase_01 AC 42 ms
52,376 KB
testcase_02 AC 39 ms
52,904 KB
testcase_03 AC 39 ms
52,948 KB
testcase_04 AC 39 ms
52,432 KB
testcase_05 AC 38 ms
52,372 KB
testcase_06 AC 38 ms
52,676 KB
testcase_07 AC 39 ms
52,684 KB
testcase_08 MLE -
testcase_09 AC 44 ms
58,924 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 AC 171 ms
113,896 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 AC 121 ms
91,304 KB
testcase_17 AC 137 ms
91,284 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 AC 49 ms
58,752 KB
testcase_21 MLE -
testcase_22 AC 46 ms
59,896 KB
testcase_23 AC 40 ms
53,148 KB
testcase_24 AC 40 ms
53,068 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, Q = map(int, input().split())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
MOD = 998244353

dp = [[0] * (N + 2) for _ in range(N + 1)]
dp[0][1] = 1
for i, a in enumerate(A):
    for j in range(1, N + 2):
        dp[i + 1][j] += dp[i][j] * (a - 1) + dp[i][j - 1]
        dp[i + 1][j] %= MOD

for b in B:
    print(dp[N][b+1])
0