結果
| 問題 |
No.3013 ハチマキ買い星人
|
| ユーザー |
ゼット
|
| 提出日時 | 2025-01-25 12:50:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 635 bytes |
| コンパイル時間 | 413 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 114,688 KB |
| 最終ジャッジ日時 | 2025-01-25 22:23:30 |
| 合計ジャッジ時間 | 18,626 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 36 WA * 9 |
ソースコード
N,M,p,X=map(int,input().split())
G=[[] for i in range(N)]
for i in range(M):
a,b,c=map(int,input().split())
G[a-1].append((b-1,c))
G[b-1].append((a-1,c))
A=[10**18]*N
for i in range(p):
d,e=map(int,input().split())
A[d-1]=e
result=0
from heapq import heappush,heappop
S=[]
dp=[10**18]*N
dp[0]=0
heappush(S,0)
kaku=[False]*N
while S:
w=heappop(S)
time=w//(10**6)
pos=w%(10**6)
if kaku[pos]==True:
continue
kaku[pos]=True
for B in G[pos]:
z,c=B[:]
if dp[z]>dp[pos]+c:
dp[z]=dp[pos]+c
heappush(S,dp[z]*10**6+z)
for i in range(1,N):
rest=X-dp[i]
result=max(result,rest//A[i])
print(result)
ゼット