結果
問題 | No.3013 ハチマキ買い星人 |
ユーザー |
![]() |
提出日時 | 2025-01-25 13:04:03 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 622 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,424 KB |
実行使用メモリ | 823,008 KB |
最終ジャッジ日時 | 2025-01-25 22:32:16 |
合計ジャッジ時間 | 28,005 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 41 MLE * 4 |
ソースコード
from collections import deque, defaultdictfrom heapq import heappop, heappushINF = 1<<62N, M, P, Y = map(int, input().split())E = defaultdict(list)for _ in range(M):a, b, c = map(int, input().split())a, b = a-1, b-1E[a].append((b, c))E[b].append((a, c))vis = [INF]*Nq = [(0, 0)]while q:cost, i = heappop(q)if vis[i] < cost: continuevis[i] = costfor j, c in E[i]:if vis[j] < cost+c: continueheappush(q, (cost+c, j))ans = 0for _ in range(P):d, e = map(int, input().split())d = d-1money = Y-vis[d]ans = max(ans, money//e)print(ans)