結果

問題 No.2387 Yokan Factory
ユーザー Nzt3Nzt3
提出日時 2023-07-22 20:14:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 319 ms / 5,000 ms
コード長 908 bytes
コンパイル時間 4,476 ms
コンパイル使用メモリ 211,208 KB
実行使用メモリ 12,300 KB
最終ジャッジ日時 2023-10-24 03:01:07
合計ジャッジ時間 7,834 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 2 ms
4,372 KB
testcase_04 AC 2 ms
4,372 KB
testcase_05 AC 2 ms
4,372 KB
testcase_06 AC 2 ms
4,372 KB
testcase_07 AC 2 ms
4,372 KB
testcase_08 AC 2 ms
4,372 KB
testcase_09 AC 2 ms
4,372 KB
testcase_10 AC 2 ms
4,372 KB
testcase_11 AC 2 ms
4,372 KB
testcase_12 AC 2 ms
4,372 KB
testcase_13 AC 2 ms
4,372 KB
testcase_14 AC 2 ms
4,372 KB
testcase_15 AC 159 ms
12,300 KB
testcase_16 AC 96 ms
12,064 KB
testcase_17 AC 278 ms
12,088 KB
testcase_18 AC 319 ms
10,984 KB
testcase_19 AC 137 ms
9,004 KB
testcase_20 AC 73 ms
8,404 KB
testcase_21 AC 267 ms
10,668 KB
testcase_22 AC 82 ms
7,980 KB
testcase_23 AC 252 ms
8,940 KB
testcase_24 AC 87 ms
8,324 KB
testcase_25 AC 93 ms
6,556 KB
testcase_26 AC 144 ms
9,636 KB
testcase_27 AC 86 ms
10,132 KB
testcase_28 AC 2 ms
4,372 KB
testcase_29 AC 3 ms
4,372 KB
testcase_30 AC 3 ms
4,372 KB
testcase_31 AC 3 ms
4,372 KB
testcase_32 AC 2 ms
4,372 KB
testcase_33 AC 2 ms
4,372 KB
testcase_34 AC 3 ms
4,372 KB
testcase_35 AC 3 ms
4,372 KB
testcase_36 AC 2 ms
4,372 KB
testcase_37 AC 2 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,M;
  ll X;
  cin>>N>>M>>X;
  vector<vector<array<ll,3>>>G(N);
  for(int i=0;i<M;i++){
    ll u,v;
    ll A,B;
    cin>>u>>v>>A>>B;
    --u,--v;
    G[u].push_back({v,A,B});
    G[v].push_back({u,A,B});
  }
  ll ans=-1,ng=1e9+1;
  while(ng-ans>1){
    int yokan=(ans+ng)/2;
    vector<ll>dist(N,X+1);
    dist[0]=0;
    priority_queue<array<ll,2>,vector<array<ll,2>>,greater<array<ll,2>>>pq;
    pq.push({0,0});
    while(pq.size()){
      ll d=pq.top()[0],v=pq.top()[1];
      pq.pop();
      if(dist[v]<d)continue;
      for(auto i:G[v]){
        if(i[2]>=yokan&&dist[i[0]]>d+i[1]){
          dist[i[0]]=d+i[1];
          pq.push({dist[i[0]],i[0]});
        }
      }
    }
    if(dist[N-1]<=X){
      ans=yokan;
    }else{
      ng=yokan;
    }
  }
  cout<<ans<<'\n';
}
0