結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー brthyyjpbrthyyjp
提出日時 2020-10-12 15:04:05
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 462 bytes
コンパイル時間 784 ms
コンパイル使用メモリ 86,708 KB
実行使用メモリ 360,424 KB
最終ジャッジ日時 2023-09-27 23:39:29
合計ジャッジ時間 9,455 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,176 KB
testcase_01 AC 64 ms
71,400 KB
testcase_02 AC 62 ms
71,332 KB
testcase_03 AC 63 ms
71,060 KB
testcase_04 AC 62 ms
71,216 KB
testcase_05 AC 63 ms
71,056 KB
testcase_06 AC 63 ms
71,216 KB
testcase_07 AC 62 ms
71,176 KB
testcase_08 MLE -
testcase_09 AC 68 ms
75,920 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 AC 177 ms
112,828 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 AC 132 ms
90,724 KB
testcase_17 AC 149 ms
106,772 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 AC 69 ms
76,056 KB
testcase_21 MLE -
testcase_22 AC 69 ms
76,200 KB
testcase_23 AC 65 ms
71,196 KB
testcase_24 AC 63 ms
71,200 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, q = map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

mod = 998244353

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

for b in B:
    print(dp[n-1][b]%mod)
0