結果
問題 | No.1473 おでぶなおばけさん |
ユーザー | ysystem7 |
提出日時 | 2021-04-10 14:37:11 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,274 bytes |
コンパイル時間 | 2,615 ms |
コンパイル使用メモリ | 219,108 KB |
実行使用メモリ | 11,288 KB |
最終ジャッジ日時 | 2023-09-08 10:43:02 |
合計ジャッジ時間 | 7,585 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 118 ms
10,940 KB |
testcase_03 | AC | 76 ms
9,952 KB |
testcase_04 | AC | 66 ms
7,248 KB |
testcase_05 | AC | 28 ms
4,556 KB |
testcase_06 | AC | 116 ms
10,320 KB |
testcase_07 | AC | 102 ms
11,024 KB |
testcase_08 | AC | 155 ms
11,020 KB |
testcase_09 | AC | 92 ms
11,288 KB |
testcase_10 | AC | 37 ms
7,328 KB |
testcase_11 | AC | 40 ms
8,888 KB |
testcase_12 | AC | 38 ms
8,104 KB |
testcase_13 | AC | 24 ms
6,264 KB |
testcase_14 | AC | 17 ms
5,240 KB |
testcase_15 | AC | 34 ms
7,488 KB |
testcase_16 | AC | 35 ms
6,716 KB |
testcase_17 | AC | 4 ms
4,376 KB |
testcase_18 | AC | 6 ms
4,376 KB |
testcase_19 | AC | 43 ms
7,400 KB |
testcase_20 | AC | 58 ms
9,120 KB |
testcase_21 | AC | 74 ms
9,156 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 144 ms
9,904 KB |
testcase_26 | AC | 146 ms
10,148 KB |
testcase_27 | AC | 37 ms
6,012 KB |
testcase_28 | AC | 130 ms
10,960 KB |
testcase_29 | AC | 71 ms
9,008 KB |
testcase_30 | AC | 106 ms
9,956 KB |
testcase_31 | AC | 75 ms
10,944 KB |
testcase_32 | AC | 84 ms
10,616 KB |
testcase_33 | AC | 60 ms
9,152 KB |
testcase_34 | AC | 33 ms
6,196 KB |
testcase_35 | AC | 32 ms
6,452 KB |
testcase_36 | AC | 62 ms
7,988 KB |
testcase_37 | AC | 75 ms
8,832 KB |
testcase_38 | AC | 13 ms
4,380 KB |
testcase_39 | AC | 35 ms
6,800 KB |
testcase_40 | AC | 36 ms
6,792 KB |
testcase_41 | AC | 35 ms
6,484 KB |
testcase_42 | AC | 35 ms
6,456 KB |
testcase_43 | AC | 41 ms
8,488 KB |
testcase_44 | AC | 41 ms
8,428 KB |
testcase_45 | AC | 42 ms
8,616 KB |
testcase_46 | AC | 61 ms
8,688 KB |
testcase_47 | AC | 76 ms
9,836 KB |
testcase_48 | AC | 78 ms
9,288 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=1,R=1000000000+5; 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できると信じろ!!! //どうしてもわからないときはサンプルで実験 何か見えてくるかも //頭で考えてダメなら紙におこせ!!