結果

問題 No.1473 おでぶなおばけさん
ユーザー kwm_tkwm_t
提出日時 2021-04-10 18:53:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,445 bytes
コンパイル時間 1,876 ms
コンパイル使用メモリ 172,492 KB
実行使用メモリ 9,956 KB
最終ジャッジ日時 2023-09-08 14:40:31
合計ジャッジ時間 8,539 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,904 KB
testcase_01 AC 4 ms
5,772 KB
testcase_02 AC 97 ms
9,740 KB
testcase_03 AC 77 ms
9,380 KB
testcase_04 AC 63 ms
7,840 KB
testcase_05 AC 28 ms
6,672 KB
testcase_06 AC 110 ms
9,468 KB
testcase_07 AC 103 ms
9,740 KB
testcase_08 AC 138 ms
9,956 KB
testcase_09 AC 91 ms
9,948 KB
testcase_10 AC 35 ms
7,664 KB
testcase_11 AC 37 ms
8,580 KB
testcase_12 AC 35 ms
8,036 KB
testcase_13 AC 23 ms
6,940 KB
testcase_14 AC 18 ms
6,784 KB
testcase_15 AC 31 ms
7,772 KB
testcase_16 AC 35 ms
7,536 KB
testcase_17 AC 6 ms
5,904 KB
testcase_18 AC 8 ms
6,092 KB
testcase_19 AC 41 ms
7,864 KB
testcase_20 AC 61 ms
8,780 KB
testcase_21 AC 71 ms
8,788 KB
testcase_22 AC 55 ms
9,308 KB
testcase_23 AC 43 ms
8,996 KB
testcase_24 AC 42 ms
8,828 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 117 ms
9,668 KB
testcase_29 AC 74 ms
8,700 KB
testcase_30 AC 90 ms
9,152 KB
testcase_31 AC 83 ms
9,664 KB
testcase_32 AC 82 ms
9,588 KB
testcase_33 AC 60 ms
8,816 KB
testcase_34 AC 35 ms
7,356 KB
testcase_35 AC 33 ms
7,740 KB
testcase_36 AC 58 ms
8,344 KB
testcase_37 AC 80 ms
8,572 KB
testcase_38 AC 14 ms
6,428 KB
testcase_39 AC 35 ms
7,444 KB
testcase_40 AC 35 ms
7,524 KB
testcase_41 AC 33 ms
7,200 KB
testcase_42 AC 33 ms
7,456 KB
testcase_43 AC 40 ms
8,120 KB
testcase_44 AC 39 ms
8,180 KB
testcase_45 AC 39 ms
8,044 KB
testcase_46 AC 63 ms
8,784 KB
testcase_47 AC 87 ms
9,108 KB
testcase_48 AC 80 ms
8,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
//#include "atcoder/all"
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
const int INF = 1e9;
const long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n-1); i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define endl "\n"
int n, m;
struct Edge {
	int to, w;
	Edge(int to, int w) :to(to), w(w) {}
};
vector<Edge>g[100005];
int f(long long x) {
	vector<int>d(n, INF);
	queue<int> q;
	q.emplace(0);
	d[0] = 0;
	while (!q.empty()) {
		int now = q.front();
		q.pop();
		for (auto e : g[now]) {
			if (e.w < x) { continue; }
			if (d[e.to] > d[now] + 1) {
				d[e.to] = d[now] + 1;
				q.emplace(e.to);
			}
		}
	}
	if (INF == d[n - 1]) {
		return -1;
	}
	return d[n - 1];
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> m;
	rep(i, m) {
		int s, t, d;
		cin >> s >> t >> d;
		s--;
		t--;
		g[s].emplace_back(t, d);
		g[t].emplace_back(s, d);
	}
	long long ng = INF;
	long long ok = 0;
	int ans = 0;
	while (1 < abs(ok - ng)) {
		long long c = (ng + ok) / 2;
		int ret = f(c);
		if (-1 != ret) { ok = c; ans = ret; }
		else { ng = c; }
	}
	cout << ok << " " << ans << endl;
	return 0;
}
0