結果
| 問題 |
No.2310 [Cherry 5th Tune A] Against Regret
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-20 00:09:38 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 526 bytes |
| コンパイル時間 | 267 ms |
| コンパイル使用メモリ | 82,112 KB |
| 実行使用メモリ | 849,968 KB |
| 最終ジャッジ日時 | 2024-12-20 03:20:22 |
| 合計ジャッジ時間 | 158,762 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 2 TLE * 3 MLE * 24 |
ソースコード
from collections import deque
import heapq
import copy
mod=998244353
n=int(input())
Edge=[list(map(int,input().split())) for _ in range(n+1)]
Q=int(input())
for _ in range(Q):
E=copy.deepcopy(Edge)
K=int(input())
for _ in range(K):
a,b,c=map(int,input().split())
E[a][b]+=c
tmp=[0]*(n+1)
tmp[0]=1
q=[]
heapq.heappush(q,0)
while q:
x=heapq.heappop(q)
for i in range(x+1,n+1):
if 0<E[x][i]:
tmp[i]+=tmp[x]*E[x][i]
tmp[i]%=mod
heapq.heappush(q,i)
print(tmp[-1]%mod)