結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー takakintakakin
提出日時 2020-06-11 22:14:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 303 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 67,584 KB
最終ジャッジ日時 2024-06-24 03:24:14
合計ジャッジ時間 3,341 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
51,968 KB
testcase_01 AC 42 ms
52,352 KB
testcase_02 AC 41 ms
51,712 KB
testcase_03 AC 39 ms
52,096 KB
testcase_04 AC 39 ms
51,840 KB
testcase_05 AC 39 ms
51,840 KB
testcase_06 AC 38 ms
51,968 KB
testcase_07 AC 45 ms
51,968 KB
testcase_08 AC 99 ms
66,432 KB
testcase_09 AC 47 ms
58,240 KB
testcase_10 AC 165 ms
67,584 KB
testcase_11 AC 85 ms
66,176 KB
testcase_12 AC 81 ms
65,408 KB
testcase_13 AC 88 ms
65,920 KB
testcase_14 AC 88 ms
65,792 KB
testcase_15 AC 132 ms
66,688 KB
testcase_16 AC 73 ms
65,664 KB
testcase_17 AC 76 ms
65,024 KB
testcase_18 AC 127 ms
66,560 KB
testcase_19 AC 81 ms
65,536 KB
testcase_20 AC 45 ms
58,240 KB
testcase_21 AC 111 ms
66,432 KB
testcase_22 AC 47 ms
57,856 KB
testcase_23 AC 42 ms
52,096 KB
testcase_24 AC 41 ms
51,584 KB
testcase_25 AC 169 ms
67,584 KB
testcase_26 AC 156 ms
67,328 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