結果
問題 | No.1473 おでぶなおばけさん |
ユーザー | ysystem7 |
提出日時 | 2021-04-10 14:35:51 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,274 bytes |
コンパイル時間 | 2,705 ms |
コンパイル使用メモリ | 219,352 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2023-09-08 10:41:47 |
合計ジャッジ時間 | 8,435 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 125 ms
10,948 KB |
testcase_03 | AC | 76 ms
9,956 KB |
testcase_04 | AC | 68 ms
7,408 KB |
testcase_05 | AC | 29 ms
4,568 KB |
testcase_06 | AC | 120 ms
10,376 KB |
testcase_07 | AC | 103 ms
11,072 KB |
testcase_08 | AC | 156 ms
11,264 KB |
testcase_09 | AC | 92 ms
11,200 KB |
testcase_10 | AC | 38 ms
7,200 KB |
testcase_11 | AC | 40 ms
8,896 KB |
testcase_12 | AC | 38 ms
8,040 KB |
testcase_13 | AC | 24 ms
6,296 KB |
testcase_14 | AC | 18 ms
5,316 KB |
testcase_15 | AC | 34 ms
7,640 KB |
testcase_16 | AC | 35 ms
6,828 KB |
testcase_17 | AC | 4 ms
4,380 KB |
testcase_18 | AC | 6 ms
4,376 KB |
testcase_19 | AC | 42 ms
7,496 KB |
testcase_20 | AC | 57 ms
9,124 KB |
testcase_21 | AC | 73 ms
9,040 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 150 ms
9,900 KB |
testcase_26 | AC | 152 ms
10,204 KB |
testcase_27 | AC | 38 ms
5,912 KB |
testcase_28 | AC | 127 ms
10,892 KB |
testcase_29 | AC | 71 ms
8,844 KB |
testcase_30 | AC | 96 ms
9,944 KB |
testcase_31 | AC | 74 ms
11,012 KB |
testcase_32 | AC | 87 ms
10,592 KB |
testcase_33 | AC | 60 ms
9,088 KB |
testcase_34 | AC | 33 ms
6,240 KB |
testcase_35 | AC | 32 ms
6,396 KB |
testcase_36 | AC | 62 ms
8,104 KB |
testcase_37 | AC | 80 ms
8,700 KB |
testcase_38 | AC | 14 ms
4,380 KB |
testcase_39 | AC | 35 ms
6,764 KB |
testcase_40 | AC | 35 ms
6,700 KB |
testcase_41 | AC | 36 ms
6,352 KB |
testcase_42 | AC | 35 ms
6,480 KB |
testcase_43 | AC | 42 ms
8,532 KB |
testcase_44 | AC | 41 ms
8,528 KB |
testcase_45 | AC | 42 ms
8,432 KB |
testcase_46 | AC | 63 ms
8,640 KB |
testcase_47 | AC | 80 ms
9,900 KB |
testcase_48 | AC | 76 ms
9,368 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+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できると信じろ!!! //どうしてもわからないときはサンプルで実験 何か見えてくるかも //頭で考えてダメなら紙におこせ!!