結果

問題 No.1473 おでぶなおばけさん
ユーザー Example0911Example0911
提出日時 2021-04-09 21:48:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 930 bytes
コンパイル時間 2,944 ms
コンパイル使用メモリ 208,176 KB
実行使用メモリ 11,476 KB
最終ジャッジ日時 2023-09-07 10:47:05
合計ジャッジ時間 8,046 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 136 ms
11,232 KB
testcase_03 AC 76 ms
10,204 KB
testcase_04 AC 69 ms
7,612 KB
testcase_05 AC 28 ms
4,640 KB
testcase_06 AC 123 ms
10,716 KB
testcase_07 AC 109 ms
11,416 KB
testcase_08 AC 164 ms
11,408 KB
testcase_09 AC 104 ms
11,412 KB
testcase_10 AC 36 ms
7,224 KB
testcase_11 AC 39 ms
8,852 KB
testcase_12 AC 36 ms
8,008 KB
testcase_13 AC 22 ms
6,148 KB
testcase_14 AC 16 ms
5,332 KB
testcase_15 AC 32 ms
7,524 KB
testcase_16 AC 32 ms
6,688 KB
testcase_17 AC 4 ms
4,376 KB
testcase_18 AC 6 ms
4,380 KB
testcase_19 AC 44 ms
7,572 KB
testcase_20 AC 58 ms
9,516 KB
testcase_21 AC 77 ms
9,196 KB
testcase_22 AC 58 ms
10,404 KB
testcase_23 AC 44 ms
9,456 KB
testcase_24 AC 46 ms
9,412 KB
testcase_25 AC 96 ms
10,100 KB
testcase_26 AC 100 ms
10,388 KB
testcase_27 AC 28 ms
5,872 KB
testcase_28 AC 136 ms
11,236 KB
testcase_29 AC 75 ms
8,976 KB
testcase_30 AC 96 ms
10,224 KB
testcase_31 AC 90 ms
11,476 KB
testcase_32 AC 88 ms
10,916 KB
testcase_33 AC 68 ms
9,548 KB
testcase_34 AC 37 ms
6,524 KB
testcase_35 AC 31 ms
6,664 KB
testcase_36 AC 61 ms
8,228 KB
testcase_37 AC 79 ms
8,964 KB
testcase_38 AC 14 ms
4,408 KB
testcase_39 AC 34 ms
6,928 KB
testcase_40 AC 33 ms
6,772 KB
testcase_41 AC 33 ms
6,340 KB
testcase_42 AC 34 ms
6,368 KB
testcase_43 AC 43 ms
9,076 KB
testcase_44 AC 43 ms
9,016 KB
testcase_45 AC 42 ms
9,012 KB
testcase_46 AC 59 ms
8,988 KB
testcase_47 AC 84 ms
10,264 KB
testcase_48 AC 79 ms
9,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
//#define int long long
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 61);
ll mod = 1000000007;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, m;
	cin >> n >> m;
	vector<vector<pair<ll, ll>>>G(n);
	for (int i = 0; i < m; i++) {
		ll s, t, d; cin >> s >> t >> d; s--; t--;
		G[s].push_back({ t, d });
		G[t].push_back({ s, d });
	}
	ll l = -1, r = 1001001001001;
	ll ans = 0;
	while (r - l > 1) {
		ll mid = (l + r) / 2;
		queue<ll>q;
		vector<ll>now(n, -1);
		q.push(0);
		now[0] = 0;
		while (!q.empty()) {
			ll p = q.front(); q.pop();
			for (auto nv : G[p]) {
				ll to = nv.first, tmp = nv.second;
				if (tmp < mid)continue;
				if (now[to] != -1)continue;
				now[to] = now[p] + 1;
				q.push(to);
			}
		}
		if (now[n - 1] == -1)r = mid;
		else {
			l = mid;
			ans = now[n - 1];
		}
	}
	cout << l << " " << ans << endl;
	return 0;
}
0