結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー takakintakakin
提出日時 2020-06-11 22:14:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 303 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 76,988 KB
最終ジャッジ日時 2023-09-06 08:40:22
合計ジャッジ時間 4,284 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,212 KB
testcase_01 AC 66 ms
71,232 KB
testcase_02 AC 69 ms
71,080 KB
testcase_03 AC 64 ms
71,320 KB
testcase_04 AC 66 ms
71,312 KB
testcase_05 AC 65 ms
71,420 KB
testcase_06 AC 66 ms
71,220 KB
testcase_07 AC 66 ms
71,280 KB
testcase_08 AC 120 ms
76,780 KB
testcase_09 AC 76 ms
75,856 KB
testcase_10 AC 174 ms
76,932 KB
testcase_11 AC 105 ms
76,536 KB
testcase_12 AC 97 ms
76,504 KB
testcase_13 AC 102 ms
76,840 KB
testcase_14 AC 108 ms
76,536 KB
testcase_15 AC 146 ms
76,840 KB
testcase_16 AC 93 ms
76,984 KB
testcase_17 AC 96 ms
76,840 KB
testcase_18 AC 146 ms
76,988 KB
testcase_19 AC 104 ms
76,516 KB
testcase_20 AC 70 ms
75,688 KB
testcase_21 AC 134 ms
76,784 KB
testcase_22 AC 74 ms
75,720 KB
testcase_23 AC 69 ms
71,284 KB
testcase_24 AC 68 ms
71,292 KB
testcase_25 AC 189 ms
76,776 KB
testcase_26 AC 169 ms
76,732 KB
権限があれば一括ダウンロードができます

ソースコード

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=[1]+[0]*n
for i,a in enumerate(A):
  for j in range(i+1)[::-1]:
    DP[j+1]=((a-1)*DP[j]+DP[j+1])%mod
for b in B:
  print(DP[n-b])
0