結果
| 問題 |
No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
|
| コンテスト | |
| ユーザー |
双六
|
| 提出日時 | 2020-08-11 04:56:57 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 595 bytes |
| コンパイル時間 | 281 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 150,304 KB |
| 最終ジャッジ日時 | 2024-10-09 11:08:46 |
| 合計ジャッジ時間 | 4,273 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 MLE * 1 -- * 18 |
ソースコード
# 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()
双六