結果

問題 No.2387 Yokan Factory
ユーザー t98slidert98slider
提出日時 2023-07-21 21:38:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,194 bytes
コンパイル時間 2,008 ms
コンパイル使用メモリ 184,560 KB
実行使用メモリ 16,564 KB
最終ジャッジ日時 2023-10-21 21:33:19
合計ジャッジ時間 9,700 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 187 ms
12,928 KB
testcase_16 AC 96 ms
11,900 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, m, x, ok = -1, ng = 1ll << 30, mid;
    cin >> n >> m >> x;
    vector<vector<tuple<int, ll, ll>>> g(n);
    vector<ll> dist(n, 1ll << 60);
    for(int i = 0; i < m; i++){
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        a--, b--;
        g[a].emplace_back(b, c, d);
        g[b].emplace_back(a, c, d);
    }
    while(ok + 1 < ng){
        mid = (ok + ng) / 2;
        priority_queue<pair<ll,int>, vector<pair<ll,int>>, greater<pair<ll,int>>> pq;
        fill(dist.begin(), dist.end(), 1ll << 60);
        pq.emplace(0, 0);
        dist[0] = 0;
        while(!pq.empty()){
            ll d, c, e;
            int v, u;
            tie(d, v) = pq.top();
            pq.pop();
            if(dist[v] > d) continue;
            for(auto &&pa : g[v]){
                tie(u, c, e) = pa;
                if(e < mid) continue;
                if(d + c >= dist[u]) continue;
                dist[u] = d + c;
                pq.emplace(d + c, u);
            }
        }
        (dist[n - 1] <= x ? ok : ng) = mid;
    }
    cout << ok << '\n';
}
0