結果

問題 No.2387 Yokan Factory
ユーザー hiro71687khiro71687k
提出日時 2023-07-23 21:36:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,397 bytes
コンパイル時間 6,031 ms
コンパイル使用メモリ 269,760 KB
実行使用メモリ 15,284 KB
最終ジャッジ日時 2023-10-25 05:37:35
合計ジャッジ時間 14,015 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
15,284 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 135 ms
11,876 KB
testcase_16 AC 133 ms
10,584 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>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353 ;
ld inf=10000999999999900;
int main(){
    ll n,m,x;
    cin >> n >> m >> x;
    vector<vector<pair<ll,pair<ll,ll>>>>g(n);
    for (ll i = 0; i < m; i++)
    {
        ll u,v,a,b;
        cin >> u >> v >> a >> b;
        u--,v--;
        g[u].push_back({v,{a,b}});
        g[v].push_back({u,{a,b}});
    }
    ll left=0,right=inf;
    while (right-left>1)
    {
        ll mid=(right+left)/2;
        queue<ll>que;
        que.push(0);
        vector<ll>memo(n,inf);
        memo[0]=0;
        while (!que.empty())
        {
            ll v=que.front();
            que.pop();
            for (ll j = 0; j < g[v].size(); j++)
            {
                if (g[v][j].second.second<mid)
                {
                    continue;
                }
                if (memo[g[v][j].first]>memo[v]+g[v][j].second.first)
                {
                    memo[g[v][j].first]=memo[v]+g[v][j].second.first;
                    que.push(g[v][j].first);
                }
            }
        }
        if (memo[n-1]>x)
        {
            right=mid;
        }else{
            left=mid;
        }
    }
    if (left==0)
    {
        cout << -1 << endl;
        return 0;
    }
    
    cout << left << endl;
}
0