結果

問題 No.2387 Yokan Factory
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-07-21 21:38:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 896 bytes
コンパイル時間 4,543 ms
コンパイル使用メモリ 214,888 KB
実行使用メモリ 14,740 KB
最終ジャッジ日時 2023-10-21 21:33:09
合計ジャッジ時間 8,987 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 4 ms
5,948 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 3 ms
5,952 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 4 ms
5,952 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 4 ms
5,952 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 55 ms
8,312 KB
testcase_26 AC 109 ms
10,984 KB
testcase_27 AC 119 ms
11,256 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 6 ms
6,068 KB
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, int>;
using T = tuple<ll, ll, int>;
int main () {
	int N, M; ll X;
	cin >> N >> M >> X;
	std::vector<T> gr[100020];
	for (int i = 0; i < M; i ++) {
		int u, v; ll a, b;
		cin >> u >> v >> a >> b;
		gr[--u].emplace_back(b, a, --v);
		gr[v].emplace_back(b, a, u);
	}
	ll ok = -1; ll ng = 1e9 + 7;
	vector<ll> D(N);
	while (abs(ok - ng) > 1) {
		ll mu = (ok + ng) / 2;
		priority_queue<P, vector<P>, greater<P>> pque;
		D.assign(N, X + 100);
		D[0] = 0;
		pque.emplace(0, 0);
		while (!pque.empty()) {
			auto [l, u] = pque.top();
			pque.pop();
			if (l != D[u]) continue;
			for (auto [b, a, v] : gr[u]) {
				if (b > mu) continue;
				if (D[v] > D[u] + a) {
					D[v] = D[u] + a;
					pque.emplace(D[v], v);
				}
			}
		}
		if (D[N - 1] > X) {
			ng = mu;
		} else {
			ok = mu;
		}
	}
	cout << ok << endl;
}
0