結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー Kiri8128Kiri8128
提出日時 2020-05-30 00:31:24
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 368 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 82,492 KB
実行使用メモリ 206,152 KB
最終ジャッジ日時 2024-04-24 03:09:04
合計ジャッジ時間 4,639 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,224 KB
testcase_01 AC 38 ms
52,608 KB
testcase_02 AC 39 ms
52,096 KB
testcase_03 AC 40 ms
51,968 KB
testcase_04 AC 37 ms
52,096 KB
testcase_05 AC 35 ms
51,968 KB
testcase_06 AC 34 ms
51,840 KB
testcase_07 AC 34 ms
52,224 KB
testcase_08 AC 189 ms
114,272 KB
testcase_09 AC 42 ms
59,520 KB
testcase_10 MLE -
testcase_11 AC 132 ms
91,264 KB
testcase_12 AC 117 ms
91,136 KB
testcase_13 AC 135 ms
91,136 KB
testcase_14 AC 148 ms
107,800 KB
testcase_15 MLE -
testcase_16 AC 97 ms
88,960 KB
testcase_17 AC 102 ms
91,140 KB
testcase_18 MLE -
testcase_19 AC 136 ms
91,700 KB
testcase_20 AC 41 ms
59,392 KB
testcase_21 MLE -
testcase_22 AC 41 ms
59,520 KB
testcase_23 AC 35 ms
51,840 KB
testcase_24 AC 35 ms
52,352 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