結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー mkawa2mkawa2
提出日時 2021-05-27 22:45:41
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,041 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 359,424 KB
最終ジャッジ日時 2024-04-24 09:08:09
合計ジャッジ時間 5,551 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,224 KB
testcase_01 AC 36 ms
51,968 KB
testcase_02 AC 37 ms
51,840 KB
testcase_03 AC 38 ms
52,096 KB
testcase_04 AC 38 ms
51,840 KB
testcase_05 AC 36 ms
52,224 KB
testcase_06 AC 36 ms
52,096 KB
testcase_07 AC 38 ms
52,224 KB
testcase_08 MLE -
testcase_09 AC 45 ms
58,880 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 AC 143 ms
113,496 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 AC 99 ms
90,944 KB
testcase_17 AC 111 ms
91,648 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 AC 46 ms
59,008 KB
testcase_21 MLE -
testcase_22 AC 44 ms
59,648 KB
testcase_23 AC 40 ms
52,352 KB
testcase_24 AC 39 ms
52,224 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
dij = [(0, 1), (1, 0), (1, 1), (1, -1)]
inf = 10**16
md = 998244353
# md = 10**9+7

n, q = LI()
aa = LI()
bb=LI()

dp=[[0]*(n+1) for _ in range(n+1)]
dp[0][0]=1

for i,a in enumerate(aa):
    for j in range(i+1):
        pre=dp[i][j]
        if pre==0:continue
        dp[i+1][j]=(dp[i+1][j]+pre*(a-1))%md
        dp[i+1][j+1]=(dp[i+1][j+1]+pre)%md

for b in bb:print(dp[n][b])
0