結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー stngstng
提出日時 2022-08-19 17:52:18
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 445 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 82,004 KB
実行使用メモリ 359,240 KB
最終ジャッジ日時 2024-04-16 21:29:52
合計ジャッジ時間 6,977 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,028 KB
testcase_01 AC 37 ms
53,016 KB
testcase_02 AC 39 ms
53,884 KB
testcase_03 AC 40 ms
52,072 KB
testcase_04 AC 37 ms
52,608 KB
testcase_05 AC 37 ms
53,228 KB
testcase_06 AC 38 ms
52,288 KB
testcase_07 AC 36 ms
53,620 KB
testcase_08 MLE -
testcase_09 AC 42 ms
59,116 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 AC 169 ms
113,392 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 AC 119 ms
90,680 KB
testcase_17 AC 127 ms
90,752 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 AC 40 ms
59,172 KB
testcase_21 MLE -
testcase_22 AC 44 ms
60,888 KB
testcase_23 AC 34 ms
52,956 KB
testcase_24 AC 35 ms
52,352 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353
n,q = map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

dp = [[0]*(n+1) for i in range(n+1)]
dp[0][0] = 1

for i in range(n):
    for j in range(n+1):
        if j >= 1:
            dp[i+1][j] = dp[i][j]*(a[i]-1)%mod + dp[i][j-1]%mod
        else:
            dp[i+1][j] = dp[i][j]*(a[i]-1)%mod
        dp[i+1][j] %= mod

for i in range(q):
    print(dp[n][b[i]])
#print(dp[n])
0