結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー 👑 KazunKazun
提出日時 2020-06-10 15:27:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 471 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 87,296 KB
実行使用メモリ 80,268 KB
最終ジャッジ日時 2023-09-05 10:30:19
合計ジャッジ時間 6,197 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,340 KB
testcase_01 AC 68 ms
71,572 KB
testcase_02 AC 74 ms
71,596 KB
testcase_03 AC 69 ms
71,452 KB
testcase_04 AC 68 ms
71,388 KB
testcase_05 AC 69 ms
71,384 KB
testcase_06 AC 69 ms
71,516 KB
testcase_07 AC 69 ms
71,384 KB
testcase_08 AC 226 ms
78,288 KB
testcase_09 AC 77 ms
76,044 KB
testcase_10 AC 457 ms
79,880 KB
testcase_11 AC 168 ms
78,108 KB
testcase_12 AC 151 ms
77,652 KB
testcase_13 AC 171 ms
78,088 KB
testcase_14 AC 177 ms
77,968 KB
testcase_15 AC 332 ms
78,988 KB
testcase_16 AC 123 ms
77,976 KB
testcase_17 AC 128 ms
77,576 KB
testcase_18 AC 310 ms
78,972 KB
testcase_19 AC 166 ms
77,908 KB
testcase_20 AC 79 ms
76,544 KB
testcase_21 AC 258 ms
78,540 KB
testcase_22 AC 75 ms
76,540 KB
testcase_23 AC 70 ms
71,380 KB
testcase_24 AC 70 ms
71,328 KB
testcase_25 AC 467 ms
80,268 KB
testcase_26 AC 471 ms
80,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#--------------------------------------
N,Q=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
M=998244353

D=[i==0 for i in range(N+1)]
E=[0]*(N+1)

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

    for k in range(N+1):
        D[k]=E[k]
        
for b in B:
    print(D[b])
        
    
0