結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー Coki628Coki628
提出日時 2020-10-27 00:33:45
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,015 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 87,656 KB
実行使用メモリ 360,844 KB
最終ジャッジ日時 2023-09-29 03:07:32
合計ジャッジ時間 10,912 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,836 KB
testcase_01 AC 71 ms
71,508 KB
testcase_02 AC 75 ms
71,696 KB
testcase_03 AC 72 ms
71,852 KB
testcase_04 AC 72 ms
71,496 KB
testcase_05 AC 75 ms
71,864 KB
testcase_06 AC 73 ms
71,656 KB
testcase_07 AC 74 ms
72,004 KB
testcase_08 MLE -
testcase_09 AC 81 ms
76,556 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 AC 234 ms
110,780 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 AC 185 ms
102,768 KB
testcase_17 AC 198 ms
106,900 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 AC 79 ms
76,752 KB
testcase_21 MLE -
testcase_22 AC 83 ms
76,888 KB
testcase_23 AC 72 ms
71,768 KB
testcase_24 AC 72 ms
71,724 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c for j in range(b)] for i in range(a)]
def list3d(a, b, c, d): return [[[d for k in range(c)] for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 998244353
EPS = 10**-10

N, M = MAP()
A = LIST()
B = LIST()

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

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