結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー roarisroaris
提出日時 2020-06-27 07:31:35
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 454 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 360,464 KB
最終ジャッジ日時 2023-09-18 19:01:42
合計ジャッジ時間 11,007 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
70,960 KB
testcase_01 AC 76 ms
71,300 KB
testcase_02 AC 76 ms
71,188 KB
testcase_03 AC 76 ms
71,096 KB
testcase_04 AC 75 ms
71,356 KB
testcase_05 AC 77 ms
71,012 KB
testcase_06 AC 76 ms
71,280 KB
testcase_07 AC 74 ms
71,372 KB
testcase_08 MLE -
testcase_09 AC 83 ms
75,996 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 AC 235 ms
113,368 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 AC 173 ms
90,900 KB
testcase_17 AC 197 ms
106,928 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 AC 84 ms
76,284 KB
testcase_21 MLE -
testcase_22 AC 83 ms
76,368 KB
testcase_23 AC 75 ms
71,256 KB
testcase_24 AC 76 ms
71,176 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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)]
dp[0][0] = 1
MOD = 998244353

for i in range(N):
    for j in range(N+1):
        dp[i+1][j] += dp[i][j]
        dp[i+1][j] %= MOD
        
        if j+1<=N:
            dp[i+1][j+1] += dp[i][j]*(A[i]-1)
            dp[i+1][j+1] %= MOD

for Bi in B:
    print(dp[N][N-Bi])
0