結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー takakintakakin
提出日時 2020-06-11 22:12:31
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 367 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 360,340 KB
最終ジャッジ日時 2023-09-06 08:39:50
合計ジャッジ時間 6,418 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,512 KB
testcase_01 AC 72 ms
71,412 KB
testcase_02 AC 72 ms
71,312 KB
testcase_03 AC 72 ms
71,292 KB
testcase_04 AC 72 ms
71,296 KB
testcase_05 AC 72 ms
71,520 KB
testcase_06 AC 73 ms
71,124 KB
testcase_07 AC 72 ms
71,436 KB
testcase_08 MLE -
testcase_09 AC 74 ms
75,976 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 AC 156 ms
112,760 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 AC 123 ms
90,448 KB
testcase_17 AC 126 ms
90,372 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 AC 77 ms
75,932 KB
testcase_21 MLE -
testcase_22 AC 74 ms
76,060 KB
testcase_23 AC 72 ms
71,412 KB
testcase_24 AC 72 ms
71,284 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,q=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
mod=998244353
DP=[[0]*(n+1) for i in range(n+1)]
for i in range(n+1):
  DP[i][0]=1
for i,a in enumerate(A):
  for j in range(i+1):
    DP[i+1][j+1]=((a-1)*DP[i][j]+DP[i][j+1])%mod
for b in B:
  print(DP[n][n-b])
0