結果
| 問題 |
No.2387 Yokan Factory
|
| コンテスト | |
| ユーザー |
hiro71687k
|
| 提出日時 | 2023-07-23 21:36:34 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,397 bytes |
| コンパイル時間 | 4,292 ms |
| コンパイル使用メモリ | 259,196 KB |
| 最終ジャッジ日時 | 2025-02-15 18:38:55 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 TLE * 1 |
ソースコード
#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;
}
hiro71687k