結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー Kiri8128Kiri8128
提出日時 2020-05-30 00:31:24
言語 PyPy3
(7.3.13)
結果
MLE  
実行時間 -
コード長 368 bytes
コンパイル時間 974 ms
コンパイル使用メモリ 86,644 KB
実行使用メモリ 205,320 KB
最終ジャッジ日時 2023-08-06 06:57:57
合計ジャッジ時間 6,314 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,264 KB
testcase_01 AC 70 ms
71,320 KB
testcase_02 AC 70 ms
71,196 KB
testcase_03 AC 71 ms
71,400 KB
testcase_04 AC 70 ms
71,008 KB
testcase_05 AC 71 ms
71,108 KB
testcase_06 AC 69 ms
71,008 KB
testcase_07 AC 72 ms
71,300 KB
testcase_08 MLE -
testcase_09 AC 76 ms
75,936 KB
testcase_10 MLE -
testcase_11 AC 175 ms
106,052 KB
testcase_12 AC 147 ms
90,708 KB
testcase_13 AC 179 ms
107,524 KB
testcase_14 AC 185 ms
109,136 KB
testcase_15 MLE -
testcase_16 AC 127 ms
90,068 KB
testcase_17 AC 135 ms
90,780 KB
testcase_18 MLE -
testcase_19 AC 161 ms
90,592 KB
testcase_20 AC 76 ms
76,080 KB
testcase_21 MLE -
testcase_22 AC 77 ms
75,900 KB
testcase_23 AC 70 ms
71,412 KB
testcase_24 AC 70 ms
71,184 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, Q = map(int, input().split())
P = 998244353
A = [int(a) - 1 for a in input().split()]
X = [[0] * (i+1) for i in range(N+1)]
X[0][0] = 1
for i in range(N):
    for j in range(i+1):
        X[i+1][j] += X[i][j] * A[i]
        X[i+1][j+1] += X[i][j]
        X[i+1][j] %= P
        X[i+1][j+1] %= P

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