結果
問題 | No.1473 おでぶなおばけさん |
ユーザー | ysystem7 |
提出日時 | 2021-04-10 14:41:50 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 169 ms / 2,000 ms |
コード長 | 2,275 bytes |
コンパイル時間 | 2,825 ms |
コンパイル使用メモリ | 219,068 KB |
実行使用メモリ | 11,028 KB |
最終ジャッジ日時 | 2023-09-08 10:46:52 |
合計ジャッジ時間 | 8,132 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 113 ms
11,028 KB |
testcase_03 | AC | 82 ms
9,892 KB |
testcase_04 | AC | 71 ms
7,204 KB |
testcase_05 | AC | 29 ms
4,620 KB |
testcase_06 | AC | 122 ms
10,464 KB |
testcase_07 | AC | 107 ms
11,024 KB |
testcase_08 | AC | 169 ms
11,024 KB |
testcase_09 | AC | 95 ms
11,024 KB |
testcase_10 | AC | 39 ms
7,452 KB |
testcase_11 | AC | 43 ms
8,808 KB |
testcase_12 | AC | 38 ms
8,124 KB |
testcase_13 | AC | 24 ms
6,148 KB |
testcase_14 | AC | 18 ms
5,256 KB |
testcase_15 | AC | 35 ms
7,668 KB |
testcase_16 | AC | 36 ms
6,804 KB |
testcase_17 | AC | 4 ms
4,376 KB |
testcase_18 | AC | 7 ms
4,376 KB |
testcase_19 | AC | 43 ms
7,396 KB |
testcase_20 | AC | 60 ms
9,280 KB |
testcase_21 | AC | 75 ms
9,048 KB |
testcase_22 | AC | 57 ms
10,024 KB |
testcase_23 | AC | 43 ms
9,064 KB |
testcase_24 | AC | 43 ms
9,040 KB |
testcase_25 | AC | 156 ms
10,112 KB |
testcase_26 | AC | 158 ms
10,112 KB |
testcase_27 | AC | 38 ms
6,028 KB |
testcase_28 | AC | 125 ms
11,024 KB |
testcase_29 | AC | 77 ms
8,792 KB |
testcase_30 | AC | 108 ms
10,004 KB |
testcase_31 | AC | 86 ms
11,024 KB |
testcase_32 | AC | 87 ms
10,612 KB |
testcase_33 | AC | 64 ms
9,324 KB |
testcase_34 | AC | 36 ms
6,248 KB |
testcase_35 | AC | 33 ms
6,532 KB |
testcase_36 | AC | 61 ms
8,044 KB |
testcase_37 | AC | 84 ms
8,716 KB |
testcase_38 | AC | 14 ms
4,616 KB |
testcase_39 | AC | 36 ms
6,780 KB |
testcase_40 | AC | 35 ms
6,772 KB |
testcase_41 | AC | 36 ms
6,624 KB |
testcase_42 | AC | 36 ms
6,500 KB |
testcase_43 | AC | 43 ms
8,576 KB |
testcase_44 | AC | 43 ms
8,428 KB |
testcase_45 | AC | 43 ms
8,560 KB |
testcase_46 | AC | 64 ms
8,640 KB |
testcase_47 | AC | 87 ms
9,976 KB |
testcase_48 | AC | 89 ms
9,304 KB |
ソースコード
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) #define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i]; #define ft first #define sc second #define pb push_back #define lb lower_bound #define ub upper_bound #define all(v) (v).begin(),(v).end() #define LB(a,x) lb(all(a),x)-a.begin() #define UB(a,x) ub(all(a),x)-a.begin() #define mod 1000000007 //#define mod 998244353 #define FS fixed<<setprecision(15) using namespace std; typedef long long ll; const double pi=3.141592653589793; template<class T> using V=vector<T>; using P=pair<ll,ll>; typedef unsigned long long ull; typedef long double ldouble; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline void out(T a){ cout << a << '\n'; } void YN(bool ok){if(ok) cout << "Yes" << endl; else cout << "No" << endl;} //void YN(bool ok){if(ok) cout << "YES" << endl; else cout << "NO" << endl;} const ll INF=1e18; const int mx=200005; struct edge{ ll to,cost; }; int main(){ //オーバーフローは大丈夫ですか?? cin.tie(0);ios::sync_with_stdio(false); int n,m; cin>>n>>m; V<V<edge>> G(n); rep(i,m){ ll s,t,d; cin>>s>>t>>d; s--;t--; G[s].pb({t,d}); G[t].pb({s,d}); } ll L=0,R=1000000000+1; ll ans=INF; while(R-L>1){ ll mid=(L+R)/2; V<int> d(n,-1); queue<int> que; que.push(0); d[0]=0; while(que.size()){ int v=que.front(); que.pop(); for(edge e:G[v]){ int nv=e.to; if(d[nv]!=-1) continue; if(mid<=e.cost){ d[nv]=d[v]+1; que.push(nv); } } } if(d[n-1]>=0){ L=mid; ans=d[n-1]; }else{ R=mid; } } cout<<L<<' '<<ans<<endl; } //ペナルティ出しても焦らない ACできると信じろ!!! //どうしてもわからないときはサンプルで実験 何か見えてくるかも //頭で考えてダメなら紙におこせ!!