結果

問題 No.1473 おでぶなおばけさん
ユーザー abc3abc3
提出日時 2021-04-10 03:31:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,452 bytes
コンパイル時間 2,652 ms
コンパイル使用メモリ 208,176 KB
実行使用メモリ 11,540 KB
最終ジャッジ日時 2023-09-07 23:18:28
合計ジャッジ時間 10,435 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 45 ms
4,676 KB
testcase_06 WA -
testcase_07 AC 196 ms
11,536 KB
testcase_08 AC 252 ms
11,532 KB
testcase_09 AC 178 ms
11,440 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 82 ms
7,440 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 106 ms
10,396 KB
testcase_23 AC 84 ms
9,328 KB
testcase_24 AC 87 ms
9,228 KB
testcase_25 AC 242 ms
10,288 KB
testcase_26 AC 248 ms
10,424 KB
testcase_27 AC 66 ms
5,864 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 63 ms
6,552 KB
testcase_35 WA -
testcase_36 AC 113 ms
8,216 KB
testcase_37 AC 146 ms
9,152 KB
testcase_38 AC 25 ms
4,428 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 76 ms
6,528 KB
testcase_42 AC 76 ms
6,380 KB
testcase_43 AC 95 ms
9,144 KB
testcase_44 AC 95 ms
9,000 KB
testcase_45 AC 95 ms
8,992 KB
testcase_46 AC 125 ms
8,848 KB
testcase_47 AC 159 ms
10,384 KB
testcase_48 AC 148 ms
9,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P=pair<int,int>;
    const ll INF=1e18;
    const int mod=1e9+7;
    
    struct edge{
      int to;
      ll w;
      edge(int to,ll w):to(to),w(w){}
    };
    int main(){
      ll n,m;
      cin>>n>>m;
      vector<vector<edge>>G(n);
      rep(i,m){
        int s,t,d;
        cin>>s>>t>>d;
        s--;t--;
        G[s].push_back(edge(t,d));
        G[t].push_back(edge(s,d));
      }
      auto f=[&](ll W){
        vector<ll>dist(n,INF);
        dist[0]=0;
        queue<ll>q;
        q.push(0);
        while(!q.empty()){
          auto p=q.front();q.pop();
          for(auto u:G[p]){
            if(dist[u.to]==INF&&u.w>=W){
              q.push(u.to);
              dist[u.to]=dist[p]+1;
            }
          }
        }
        return dist[n-1];
      };
      ll l=0,r=1e9+5;
      ll len=INF;
      while(r-l>1){
        ll mid=(l+r)/2;
        ll dist=f(mid);
        if(dist!=INF){l=mid;chmin(len,dist);}
        else{r=mid;}
      }
      cout<<l<<" "<<len<<endl;
      return 0;
    }
0