結果
問題 | No.2387 Yokan Factory |
ユーザー | ragna |
提出日時 | 2023-07-21 23:10:17 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 947 ms / 5,000 ms |
コード長 | 1,743 bytes |
コンパイル時間 | 2,565 ms |
コンパイル使用メモリ | 179,888 KB |
実行使用メモリ | 19,492 KB |
最終ジャッジ日時 | 2023-10-21 23:11:49 |
合計ジャッジ時間 | 12,407 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,348 KB |
testcase_03 | AC | 1 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 2 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 2 ms
4,348 KB |
testcase_08 | AC | 2 ms
4,348 KB |
testcase_09 | AC | 2 ms
4,348 KB |
testcase_10 | AC | 2 ms
4,348 KB |
testcase_11 | AC | 2 ms
4,348 KB |
testcase_12 | AC | 2 ms
4,348 KB |
testcase_13 | AC | 2 ms
4,348 KB |
testcase_14 | AC | 2 ms
4,348 KB |
testcase_15 | AC | 403 ms
17,036 KB |
testcase_16 | AC | 202 ms
15,844 KB |
testcase_17 | AC | 720 ms
19,492 KB |
testcase_18 | AC | 626 ms
15,480 KB |
testcase_19 | AC | 685 ms
13,052 KB |
testcase_20 | AC | 410 ms
10,980 KB |
testcase_21 | AC | 856 ms
15,016 KB |
testcase_22 | AC | 401 ms
10,480 KB |
testcase_23 | AC | 701 ms
12,716 KB |
testcase_24 | AC | 296 ms
11,908 KB |
testcase_25 | AC | 371 ms
8,580 KB |
testcase_26 | AC | 879 ms
13,976 KB |
testcase_27 | AC | 947 ms
14,632 KB |
testcase_28 | AC | 4 ms
4,348 KB |
testcase_29 | AC | 7 ms
4,348 KB |
testcase_30 | AC | 5 ms
4,348 KB |
testcase_31 | AC | 5 ms
4,348 KB |
testcase_32 | AC | 4 ms
4,348 KB |
testcase_33 | AC | 3 ms
4,348 KB |
testcase_34 | AC | 7 ms
4,348 KB |
testcase_35 | AC | 5 ms
4,348 KB |
testcase_36 | AC | 3 ms
4,348 KB |
testcase_37 | AC | 2 ms
4,348 KB |
コンパイルメッセージ
main.cpp: In function 'bool dijkstra(std::vector<std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >&, ll)': main.cpp:44:24: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 44 | for(auto&& [p,q]:g[y]){ | ^
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++) #define rrep(i,a,b) for(ll i=(ll)(a-1);i>=(ll)(b);i--) #define MOD 998244353 #define INF 1e16 template <typename T> bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;} template <typename T> bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} ll comb(ll x,ll y){ ll ans=1; rep(i,0,y) ans*=(x-i); rep(i,0,y) ans/=(i+1); return ans; } ll rui(ll x){ if(x==0) return 1; return 2*rui(x-1); } ll fac(ll x){ if(x==0) return 1; return x*fac(x-1); } ll pow(ll x,ll n){ ll ans=1; while(n>0){ if(n&1) ans*=x; x*=x; n>>=1; } return ans; } ll n,m,x; vector<vector<pair<ll,pair<ll,ll>>>> g; bool dijkstra(vector<vector<pair<ll,pair<ll,ll>>>>& g,ll h){ vector<ll> d(n,1e18); priority_queue<pair<ll,pair<ll,ll>>,vector<pair<ll,pair<ll,ll>>>,greater<pair<ll,pair<ll,ll>>>> pq; pq.push({0,{0,1e18}}); while(!pq.empty()){ ll x=pq.top().first,y=pq.top().second.first,z=pq.top().second.second; if(d[y]>x){ d[y]=x; for(auto&& [p,q]:g[y]){ if(q.second<h) continue; pq.push({q.first+x,{p,q.second}}); } } pq.pop(); } return d[n-1]<=x; } int main(){ cin >> n >> m >> x; vector<ll> u(m),v(m),a(m),b(m); g.resize(n); rep(i,0,m){ cin >> u[i] >> v[i] >> a[i] >> b[i]; u[i]--,v[i]--; g[u[i]].push_back({v[i],{a[i],b[i]}}); g[v[i]].push_back({u[i],{a[i],b[i]}}); } ll p=-1,q=1e9; while(q-p>1){ ll r=(p+q)/2; if(dijkstra(g,r)) p=r; else q=r; } cout << p << endl; }