結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー proriboneproribone
提出日時 2020-11-26 15:37:19
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 690 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,580 KB
実行使用メモリ 30,508 KB
最終ジャッジ日時 2023-10-01 03:23:40
合計ジャッジ時間 10,164 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
29,644 KB
testcase_01 AC 129 ms
29,580 KB
testcase_02 AC 127 ms
29,676 KB
testcase_03 AC 128 ms
29,516 KB
testcase_04 AC 127 ms
29,456 KB
testcase_05 AC 130 ms
29,456 KB
testcase_06 AC 128 ms
29,464 KB
testcase_07 AC 128 ms
29,572 KB
testcase_08 AC 334 ms
30,056 KB
testcase_09 AC 130 ms
29,604 KB
testcase_10 AC 649 ms
30,488 KB
testcase_11 AC 250 ms
29,856 KB
testcase_12 AC 221 ms
30,036 KB
testcase_13 AC 253 ms
29,916 KB
testcase_14 AC 260 ms
29,936 KB
testcase_15 AC 482 ms
30,332 KB
testcase_16 AC 187 ms
29,716 KB
testcase_17 AC 195 ms
29,800 KB
testcase_18 AC 456 ms
30,228 KB
testcase_19 AC 244 ms
29,916 KB
testcase_20 AC 136 ms
29,636 KB
testcase_21 AC 377 ms
30,172 KB
testcase_22 AC 130 ms
29,464 KB
testcase_23 AC 144 ms
29,568 KB
testcase_24 AC 131 ms
29,568 KB
testcase_25 AC 677 ms
30,508 KB
testcase_26 AC 690 ms
30,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
MOD=998244353
N,Q=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

f=np.zeros(N+1,np.int64)
f[0]=1

for A in a:
    ff=f*(A-1)
    ff[1:]+=f[:-1]
    ff%=MOD
    f=ff

for B in b:
    print(f[B])
0