結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー Kiri8128Kiri8128
提出日時 2020-05-30 00:35:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-04-24 03:13:55
合計ジャッジ時間 3,857 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,968 KB
testcase_01 AC 42 ms
51,584 KB
testcase_02 AC 41 ms
51,840 KB
testcase_03 AC 41 ms
52,096 KB
testcase_04 AC 42 ms
52,096 KB
testcase_05 AC 41 ms
51,968 KB
testcase_06 AC 42 ms
52,352 KB
testcase_07 AC 44 ms
51,840 KB
testcase_08 AC 131 ms
76,288 KB
testcase_09 AC 49 ms
58,368 KB
testcase_10 AC 223 ms
76,544 KB
testcase_11 AC 107 ms
76,032 KB
testcase_12 AC 99 ms
76,288 KB
testcase_13 AC 106 ms
76,288 KB
testcase_14 AC 107 ms
76,416 KB
testcase_15 AC 173 ms
76,544 KB
testcase_16 AC 89 ms
76,032 KB
testcase_17 AC 91 ms
76,032 KB
testcase_18 AC 165 ms
76,416 KB
testcase_19 AC 107 ms
76,032 KB
testcase_20 AC 50 ms
58,752 KB
testcase_21 AC 145 ms
76,672 KB
testcase_22 AC 47 ms
58,496 KB
testcase_23 AC 42 ms
51,968 KB
testcase_24 AC 42 ms
51,840 KB
testcase_25 AC 228 ms
76,672 KB
testcase_26 AC 228 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, Q = map(int, input().split())
P = 998244353
A = [int(a) - 1 for a in input().split()]
preX = [1]

for i in range(N):
    X = [0] * (i + 2)
    for j in range(i+1):
        X[j] += preX[j] * A[i]
        X[j+1] += preX[j]
        X[j] %= P
        X[j+1] %= P
    preX = X

B = [int(a) for a in input().split()]
for a in B:
    print(X[a])
0