結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー c-yanc-yan
提出日時 2020-05-30 09:24:20
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 1,524 ms
コンパイル使用メモリ 86,776 KB
実行使用メモリ 76,936 KB
最終ジャッジ日時 2023-08-07 00:49:31
合計ジャッジ時間 5,710 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,304 KB
testcase_01 AC 72 ms
71,348 KB
testcase_02 AC 73 ms
71,204 KB
testcase_03 AC 70 ms
71,360 KB
testcase_04 AC 71 ms
71,432 KB
testcase_05 AC 71 ms
71,372 KB
testcase_06 AC 72 ms
71,428 KB
testcase_07 AC 71 ms
71,252 KB
testcase_08 AC 139 ms
76,772 KB
testcase_09 AC 78 ms
76,160 KB
testcase_10 AC 211 ms
76,912 KB
testcase_11 AC 108 ms
76,808 KB
testcase_12 AC 100 ms
76,912 KB
testcase_13 AC 109 ms
76,668 KB
testcase_14 AC 113 ms
76,880 KB
testcase_15 AC 167 ms
76,936 KB
testcase_16 AC 94 ms
76,884 KB
testcase_17 AC 95 ms
76,860 KB
testcase_18 AC 158 ms
76,556 KB
testcase_19 AC 106 ms
76,932 KB
testcase_20 AC 74 ms
76,232 KB
testcase_21 AC 140 ms
76,688 KB
testcase_22 AC 77 ms
76,032 KB
testcase_23 AC 73 ms
71,476 KB
testcase_24 AC 72 ms
71,412 KB
testcase_25 AC 214 ms
76,888 KB
testcase_26 AC 213 ms
76,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, Q = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

dp = [0] * (N + 1)
dp[1] = 1
dp[0] = A[0] - 1
for i in range(1, N):
    for j in range(i, -1, -1):
        dp[j + 1] += dp[j]
        dp[j + 1] %= 998244353
        dp[j] *= A[i] - 1
        dp[j] %= 998244353

print('\n'.join(str(dp[b]) for b in B))
0