結果

問題 No.1473 おでぶなおばけさん
ユーザー abc3abc3
提出日時 2021-04-10 03:30:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,459 bytes
コンパイル時間 6,095 ms
コンパイル使用メモリ 207,204 KB
実行使用メモリ 11,476 KB
最終ジャッジ日時 2023-09-07 23:16:28
合計ジャッジ時間 15,475 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 45 ms
4,660 KB
testcase_06 WA -
testcase_07 AC 189 ms
11,356 KB
testcase_08 AC 256 ms
11,476 KB
testcase_09 AC 160 ms
11,400 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 80 ms
7,480 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 103 ms
10,296 KB
testcase_23 AC 82 ms
9,452 KB
testcase_24 AC 86 ms
9,364 KB
testcase_25 AC 240 ms
10,232 KB
testcase_26 AC 256 ms
10,456 KB
testcase_27 AC 66 ms
5,780 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,468 KB
testcase_35 WA -
testcase_36 AC 113 ms
8,436 KB
testcase_37 AC 148 ms
9,104 KB
testcase_38 AC 25 ms
4,376 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 76 ms
6,332 KB
testcase_42 AC 76 ms
6,456 KB
testcase_43 AC 95 ms
9,064 KB
testcase_44 AC 95 ms
9,040 KB
testcase_45 AC 95 ms
9,020 KB
testcase_46 AC 132 ms
8,776 KB
testcase_47 AC 171 ms
10,088 KB
testcase_48 AC 156 ms
9,524 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 int INF=1001001001;
    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