結果
| 問題 | No.3013 ハチマキ買い星人 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-25 13:26:44 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 726 ms / 2,000 ms |
| コード長 | 566 bytes |
| 記録 | |
| コンパイル時間 | 193 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 146,832 KB |
| 最終ジャッジ日時 | 2026-06-23 22:53:01 |
| 合計ジャッジ時間 | 17,316 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 45 |
ソースコード
from collections import defaultdict import heapq N,M,P,Y=list(map(int,input().split())) dist=[10**18]*N path=defaultdict(list) for i in range(M): u,v,c=list(map(int,input().split())) u-=1 v-=1 path[u].append((v,c)) path[v].append((u,c)) dist[0]=0 c=set() Q=[] heapq.heapify(Q) heapq.heappush(Q,(0,0)) while len(Q)>0: d,p=heapq.heappop(Q) if p in c: continue c.add(p) for j,v in path[p]: if d+v<dist[j]: heapq.heappush(Q,(d+v,j)) dist[j]=d+v ans=0 for i in range(P): d,e=list(map(int,input().split())) d-=1 ans=max(ans,(Y-dist[d])//e) print(ans)