結果
問題 | No.1473 おでぶなおばけさん |
ユーザー | Novi |
提出日時 | 2021-04-12 22:03:25 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,907 bytes |
コンパイル時間 | 4,124 ms |
コンパイル使用メモリ | 234,656 KB |
実行使用メモリ | 11,748 KB |
最終ジャッジ日時 | 2023-09-11 03:07:29 |
合計ジャッジ時間 | 10,331 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 3 ms
4,380 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 83 ms
8,040 KB |
testcase_05 | AC | 35 ms
5,488 KB |
testcase_06 | AC | 159 ms
11,040 KB |
testcase_07 | AC | 137 ms
11,748 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 45 ms
9,680 KB |
testcase_12 | AC | 42 ms
8,888 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 39 ms
7,512 KB |
testcase_17 | WA | - |
testcase_18 | AC | 8 ms
4,864 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | AC | 127 ms
10,912 KB |
testcase_31 | AC | 115 ms
11,492 KB |
testcase_32 | AC | 111 ms
11,268 KB |
testcase_33 | WA | - |
testcase_34 | AC | 42 ms
6,932 KB |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | AC | 106 ms
9,344 KB |
testcase_38 | WA | - |
testcase_39 | AC | 39 ms
7,568 KB |
testcase_40 | AC | 39 ms
7,528 KB |
testcase_41 | WA | - |
testcase_42 | AC | 37 ms
7,088 KB |
testcase_43 | AC | 45 ms
9,812 KB |
testcase_44 | AC | 46 ms
9,980 KB |
testcase_45 | AC | 45 ms
9,972 KB |
testcase_46 | AC | 86 ms
9,292 KB |
testcase_47 | AC | 113 ms
10,136 KB |
testcase_48 | WA | - |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using ll = long long; #define int ll #define rng(i, a, b) for (int i = int(a); i < int(b); i++) #define rep(i, b) rng(i, 0, b) #define ALL(a) (a).begin(), (a).end() template <class t, class u> void chmax(t& a, u b) { if (a < b) a = b; } template <class t, class u> void chmin(t& a, u b) { if (b < a) a = b; } template <class t> using vc = vector<t>; template <class t> using vvc = vc<vc<t>>; using pi = pair<int, int>; using vi = vc<int>; using uint = unsigned; using ull = unsigned long long; int popcount(signed t) { return __builtin_popcount(t); } int popcount(ll t) { return __builtin_popcountll(t); } bool ispow2(int i) { return i && (i & -i) == i; } ll mask(int i) { return (ll(1) << i) - 1; } int lcm(int a, int b) { return a / __gcd(a, b) * b; } int n, m; int cnt = 0; vc<vc<pi>> G; int bfs(int w, int st = 0, int dist = 0) { vc<int> ch(100100, 1e18); ch[st] = dist; queue<pi> pq; pq.push(pi(st, dist)); while (!pq.empty()) { auto p = pq.front(); pq.pop(); auto now = p.first; auto d = p.second; for (auto u : G[now]) { if (ch[u.first] > d + 1 && u.second >= w) { ch[u.first] = d + 1; pq.push(pi(u.first, d + 1)); } } } return cnt = ch[n - 1]; } signed main() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20); cin >> n >> m; G.resize(n); 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); } int ng = 0LL; int ok = 1e9 + 2; while (abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (bfs(mid) == 1e18) { ok = mid; } else { ng = mid; } } cout << ng << " " << cnt << endl; }