結果
| 問題 |
No.3103 Butterfly Effect
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-04-15 03:05:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 675 bytes |
| コンパイル時間 | 487 ms |
| コンパイル使用メモリ | 82,504 KB |
| 実行使用メモリ | 122,260 KB |
| 最終ジャッジ日時 | 2025-04-15 03:06:10 |
| 合計ジャッジ時間 | 20,125 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 WA * 12 TLE * 1 -- * 24 |
ソースコード
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
N,QU=map(int,input().split())
ANS=1
DIS=[1<<30]*(N+1)
DIS[1]=0
E=[[] for i in range(N+1)]
Q=[]
for i in range(QU):
p,x,y=map(int,input().split())
E[x].append((y,p))
if DIS[x]<=p:
heappush(Q,(DIS[x],x))
while Q:
now,town=heappop(Q)
for to,time in E[town]:
if now<=time:
if DIS[to]==1<<30:
ANS+=1
DIS[to]=time
heappush(Q,(DIS[to],to))
elif DIS[to]>time:
DIS[to]=time
heappush(Q,(DIS[to],to))
print(ANS)
titia