結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー 👑 KazunKazun
提出日時 2020-06-10 15:24:42
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 398 bytes
コンパイル時間 912 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 360,488 KB
最終ジャッジ日時 2023-09-05 10:25:52
合計ジャッジ時間 8,244 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,620 KB
testcase_01 AC 70 ms
71,056 KB
testcase_02 AC 73 ms
70,456 KB
testcase_03 AC 69 ms
70,664 KB
testcase_04 AC 68 ms
70,616 KB
testcase_05 AC 70 ms
71,024 KB
testcase_06 AC 70 ms
70,732 KB
testcase_07 AC 71 ms
70,668 KB
testcase_08 MLE -
testcase_09 AC 91 ms
75,368 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 AC 180 ms
112,768 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 AC 137 ms
90,624 KB
testcase_17 AC 142 ms
90,496 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 AC 75 ms
75,376 KB
testcase_21 MLE -
testcase_22 AC 75 ms
75,652 KB
testcase_23 AC 68 ms
70,680 KB
testcase_24 AC 74 ms
71,128 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()))
M=998244353

D=[[0]*(N+1) for _ in range(N+1)] #D[x][k]:xまで,k個の色1

D[0][0]=1

for x in range(N):
    D[x+1][0]=((A[x]-1)*D[x][0])%M
    for k in range(N):
        D[x+1][k+1]=(D[x][k]+(A[x]-1)*D[x][k+1])%M

for b in B:
    print(D[-1][b])
        
    
0