結果
| 問題 |
No.3013 ハチマキ買い星人
|
| コンテスト | |
| ユーザー |
noriaoki
|
| 提出日時 | 2025-01-25 14:16:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 565 bytes |
| コンパイル時間 | 452 ms |
| コンパイル使用メモリ | 82,724 KB |
| 実行使用メモリ | 789,228 KB |
| 最終ジャッジ日時 | 2025-01-25 23:15:25 |
| 合計ジャッジ時間 | 108,395 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge8 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 11 TLE * 26 MLE * 8 |
ソースコード
n, m, p, y = map(int, input().split())
abc = [list(map(int, input().split())) for _ in range(m)]
de = [list(map(int, input().split())) for _ in range(p)]
g = [[] for _ in range(n+1)]
for a, b, c in abc:
g[a].append((b, c))
g[b].append((a, c))
s = [10**18+1]*(n+1)
for d, e in de:
s[d] = e
import heapq
q = [(-y, 1)]
mx = [0]*(n+1)
ans = 0
while q:
ny, nn = heapq.heappop(q)
ny *= -1
if ny < mx[nn]: continue
ans = max(ans, ny//s[nn])
for b, c in g[nn]:
if mx[b] < ny - c:
heapq.heappush(q, (c-ny, b))
print(ans)
noriaoki