結果

問題 No.2387 Yokan Factory
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-07-21 21:39:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 495 ms / 5,000 ms
コード長 896 bytes
コンパイル時間 2,370 ms
コンパイル使用メモリ 216,024 KB
実行使用メモリ 13,564 KB
最終ジャッジ日時 2023-10-21 21:34:46
合計ジャッジ時間 7,026 ms
ジャッジサーバーID
(参考情報)
judge9 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,000 KB
testcase_01 AC 4 ms
6,000 KB
testcase_02 AC 4 ms
5,996 KB
testcase_03 AC 4 ms
6,000 KB
testcase_04 AC 3 ms
6,000 KB
testcase_05 AC 3 ms
6,000 KB
testcase_06 AC 3 ms
6,000 KB
testcase_07 AC 4 ms
6,000 KB
testcase_08 AC 4 ms
6,000 KB
testcase_09 AC 4 ms
6,000 KB
testcase_10 AC 3 ms
6,000 KB
testcase_11 AC 4 ms
6,000 KB
testcase_12 AC 4 ms
6,000 KB
testcase_13 AC 3 ms
6,000 KB
testcase_14 AC 4 ms
6,000 KB
testcase_15 AC 230 ms
13,564 KB
testcase_16 AC 177 ms
13,328 KB
testcase_17 AC 356 ms
13,356 KB
testcase_18 AC 495 ms
11,916 KB
testcase_19 AC 209 ms
10,704 KB
testcase_20 AC 133 ms
10,168 KB
testcase_21 AC 442 ms
11,672 KB
testcase_22 AC 143 ms
9,692 KB
testcase_23 AC 363 ms
10,556 KB
testcase_24 AC 148 ms
10,120 KB
testcase_25 AC 134 ms
8,488 KB
testcase_26 AC 231 ms
11,156 KB
testcase_27 AC 170 ms
11,300 KB
testcase_28 AC 5 ms
6,096 KB
testcase_29 AC 6 ms
6,144 KB
testcase_30 AC 5 ms
6,124 KB
testcase_31 AC 6 ms
6,076 KB
testcase_32 AC 5 ms
6,048 KB
testcase_33 AC 5 ms
6,044 KB
testcase_34 AC 7 ms
6,148 KB
testcase_35 AC 6 ms
6,116 KB
testcase_36 AC 4 ms
6,044 KB
testcase_37 AC 4 ms
6,000 KB
権限があれば一括ダウンロードができます

ソースコード

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