結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー 双六双六
提出日時 2020-08-11 04:56:35
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 595 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 359,780 KB
最終ジャッジ日時 2024-04-17 17:00:36
合計ジャッジ時間 6,697 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
61,364 KB
testcase_01 AC 38 ms
60,900 KB
testcase_02 AC 38 ms
60,320 KB
testcase_03 AC 39 ms
62,308 KB
testcase_04 AC 40 ms
61,428 KB
testcase_05 AC 41 ms
61,096 KB
testcase_06 AC 37 ms
60,496 KB
testcase_07 AC 37 ms
60,956 KB
testcase_08 MLE -
testcase_09 AC 45 ms
62,572 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 AC 159 ms
111,220 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 AC 111 ms
89,200 KB
testcase_17 AC 129 ms
106,096 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 AC 43 ms
62,712 KB
testcase_21 MLE -
testcase_22 AC 46 ms
62,748 KB
testcase_23 AC 40 ms
60,508 KB
testcase_24 AC 40 ms
60,180 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 998244353; INF = float("inf")
import copy

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, Q = getlist()
	A = getlist()
	B = getlist()
	DP = [[0] * (N + 1) for i in range(N + 1)]
	DP[0][0] = 1
	for i in range(N):
		for j in range(N):
			DP[i + 1][j] += DP[i][j] * (A[i] - 1)
			DP[i + 1][j + 1] += DP[i][j]
			DP[i + 1][j] %= con
			DP[i + 1][j + 1] %= con

	for i in range(Q):
		print(DP[-1][B[i]])


if __name__ == '__main__':
	main()
0