結果
問題 |
No.3013 ハチマキ買い星人
|
ユーザー |
|
提出日時 | 2025-01-25 15:01:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 759 bytes |
コンパイル時間 | 870 ms |
コンパイル使用メモリ | 76,340 KB |
実行使用メモリ | 33,540 KB |
最終ジャッジ日時 | 2025-01-25 23:41:18 |
合計ジャッジ時間 | 145,030 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | TLE * 1 |
other | TLE * 45 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:22: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 26 | auto [x,v]=pq.top(); | ^ main.cpp:28:26: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 28 | for(auto [to,cost]:G[v]){ | ^
ソースコード
#include<iostream> #include<vector> #include<queue> using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) using pl=pair<long,long>; const long INF=3e18+100; int main(){ int N,M,P; long Y; cin>>N>>M>>P>>Y; vector<vector<pl>>G(N); rep(i,M){ int a,b,c; cin>>a>>b>>c; a--;b--; G[a].push_back(make_pair(b,c)); G[b].push_back(make_pair(a,c)); } vector<long> d(N,INF); priority_queue<pl,vector<pl>,greater<pl>> pq; pq.push(make_pair(0,0)); d[0]=0; while(!pq.empty()){ auto [x,v]=pq.top(); if(x>d[v]) continue; for(auto [to,cost]:G[v]){ if(d[to]<=x+cost) continue; d[to]=x+cost; pq.push(make_pair(d[to],to)); } } long ans=0; rep(i,P){ long D,E; cin>>D>>E; D--; ans=max(ans, (Y-d[D])/E); } cout<<ans<<endl; }