結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー AEnAEn
提出日時 2022-08-23 16:14:29
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 413 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 359,040 KB
最終ジャッジ日時 2024-04-19 07:45:51
合計ジャッジ時間 6,367 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,584 KB
testcase_01 AC 43 ms
51,584 KB
testcase_02 AC 42 ms
51,584 KB
testcase_03 AC 40 ms
51,840 KB
testcase_04 AC 42 ms
51,840 KB
testcase_05 AC 43 ms
51,584 KB
testcase_06 AC 43 ms
51,840 KB
testcase_07 AC 46 ms
52,096 KB
testcase_08 MLE -
testcase_09 AC 50 ms
59,264 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 AC 152 ms
114,048 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 AC 112 ms
91,264 KB
testcase_17 AC 113 ms
91,648 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 AC 48 ms
59,520 KB
testcase_21 MLE -
testcase_22 AC 48 ms
59,264 KB
testcase_23 AC 38 ms
51,968 KB
testcase_24 AC 40 ms
51,840 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, Q = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

dp = [[0]*(N+1) for _ in range(N+1)]
mod = 998244353
dp[0][0] = 1
for i in range(1, N+1):
    for j in range(i+1):
        dp[i][j] += dp[i-1][j]*(A[i-1]-1)
        dp[i][j] %= mod
        if j-1>=0:
            dp[i][j] += dp[i-1][j-1]
            dp[i][j] %= mod
for i in range(Q):
    print(dp[-1][B[i]])
0