結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー convexineqconvexineq
提出日時 2021-05-09 00:10:42
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 295 bytes
コンパイル時間 1,164 ms
コンパイル使用メモリ 81,636 KB
実行使用メモリ 68,532 KB
最終ジャッジ日時 2023-10-17 09:23:24
合計ジャッジ時間 4,235 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,372 KB
testcase_01 AC 37 ms
53,372 KB
testcase_02 AC 37 ms
53,372 KB
testcase_03 AC 38 ms
53,372 KB
testcase_04 AC 38 ms
53,372 KB
testcase_05 AC 38 ms
53,372 KB
testcase_06 AC 39 ms
53,372 KB
testcase_07 AC 37 ms
53,372 KB
testcase_08 AC 98 ms
66,484 KB
testcase_09 AC 42 ms
59,428 KB
testcase_10 AC 167 ms
68,532 KB
testcase_11 AC 79 ms
66,484 KB
testcase_12 AC 73 ms
66,484 KB
testcase_13 AC 80 ms
66,484 KB
testcase_14 AC 82 ms
66,484 KB
testcase_15 AC 132 ms
68,532 KB
testcase_16 AC 66 ms
64,436 KB
testcase_17 AC 68 ms
64,436 KB
testcase_18 AC 126 ms
66,484 KB
testcase_19 AC 79 ms
66,484 KB
testcase_20 AC 42 ms
59,428 KB
testcase_21 AC 108 ms
66,484 KB
testcase_22 AC 42 ms
59,428 KB
testcase_23 AC 38 ms
53,372 KB
testcase_24 AC 38 ms
53,372 KB
testcase_25 AC 159 ms
68,528 KB
testcase_26 AC 144 ms
68,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
n,q = map(int,input().split())
*a, = map(int,input().split())
dp = [0]*(n+1)
dp[0] = 1
for i,ai in enumerate(a):
    for j in range(1,i+2)[::-1]:
        dp[j] = (dp[j]*(ai-1) + dp[j-1])%MOD
    dp[0] = dp[0]*(ai-1)%MOD
*b, = map(int,input().split())
for i in b:
    print(dp[i])
0