結果
問題 | No.3013 ハチマキ買い星人 |
ユーザー |
|
提出日時 | 2025-01-25 13:40:21 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 144 ms |
コンパイル使用メモリ | 82,648 KB |
実行使用メモリ | 321,292 KB |
最終ジャッジ日時 | 2025-01-25 22:55:49 |
合計ジャッジ時間 | 46,425 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 37 TLE * 8 |
ソースコード
import heapqn,m,p,y=map(int,input().split())edge=[list(map(int,input().split())) for _ in range(m)]shop=[list(map(int,input().split())) for _ in range(p)]E=[[] for _ in range(n+1)]for a,b,c in edge:E[a].append([b,c])E[b].append([a,c])ds=dict()for d,e in shop:ds[d]=eD=[0]*(n+1)D[1]=yH=[(-y,1)]while H:y,x=heapq.heappop(H)for e,c in E[x]:if D[e]<max(0,D[x]-c):D[e]=max(0,D[x]-c)heapq.heappush(H,(-D[e],e))ans=0for i in range(1,n+1):if i in ds:ans=max(ans,D[i]//ds[i])print(ans)