結果
問題 | No.1301 Strange Graph Shortest Path |
ユーザー | uzzy |
提出日時 | 2020-11-27 23:33:54 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,914 bytes |
コンパイル時間 | 1,773 ms |
コンパイル使用メモリ | 178,472 KB |
実行使用メモリ | 11,988 KB |
最終ジャッジ日時 | 2024-09-13 01:11:36 |
合計ジャッジ時間 | 6,486 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
6,816 KB |
testcase_01 | AC | 4 ms
6,816 KB |
testcase_02 | WA | - |
testcase_03 | AC | 73 ms
9,728 KB |
testcase_04 | AC | 123 ms
11,648 KB |
testcase_05 | AC | 73 ms
9,812 KB |
testcase_06 | AC | 101 ms
10,980 KB |
testcase_07 | AC | 91 ms
10,612 KB |
testcase_08 | AC | 72 ms
9,796 KB |
testcase_09 | AC | 98 ms
11,200 KB |
testcase_10 | WA | - |
testcase_11 | AC | 102 ms
11,136 KB |
testcase_12 | AC | 112 ms
11,204 KB |
testcase_13 | AC | 87 ms
10,568 KB |
testcase_14 | AC | 92 ms
10,688 KB |
testcase_15 | AC | 88 ms
10,496 KB |
testcase_16 | AC | 117 ms
11,776 KB |
testcase_17 | AC | 91 ms
10,748 KB |
testcase_18 | AC | 84 ms
10,440 KB |
testcase_19 | AC | 103 ms
11,076 KB |
testcase_20 | AC | 111 ms
11,336 KB |
testcase_21 | AC | 93 ms
10,624 KB |
testcase_22 | AC | 115 ms
11,712 KB |
testcase_23 | AC | 91 ms
10,588 KB |
testcase_24 | AC | 113 ms
11,456 KB |
testcase_25 | AC | 117 ms
11,332 KB |
testcase_26 | AC | 95 ms
10,824 KB |
testcase_27 | AC | 103 ms
11,052 KB |
testcase_28 | AC | 73 ms
9,980 KB |
testcase_29 | WA | - |
testcase_30 | AC | 112 ms
11,208 KB |
testcase_31 | AC | 110 ms
11,328 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 95 ms
11,372 KB |
ソースコード
//#pragma GCC optimize ("O2") //#pragma GCC target ("avx2") #include<bits/stdc++.h> //#include<atcoder/all> //using namespace atcoder; using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i, n) for(int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\n" #define cesp(x) cerr << (x) << " " #define pb push_back #define mp make_pair #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) #define Would #define you #define please vector<pair<int, int>> E[100001]; int C[100001], D[100001]; pair<int, int> mae[100001]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, M; cin >> N >> M; rep(i, M) { int u, v, c, d; cin >> u >> v >> c >> d; E[u].pb({ v, i }); E[v].pb({ u, i }); C[i] = c; D[i] = d; } #define PT pair<ll, int> ll Di[100001]; rep1(i, N) Di[i] = 1e18; priority_queue<PT, vector<PT>, greater<PT>> que; Di[1] = 0; que.push(mp(0, 1)); while (que.size()) { PT p = que.top(); que.pop(); int i = p.second; if (Di[i] != p.first) continue; for (PT p2 : E[i]) { int j = p2.first; int cc = C[p2.second]; int dd = C[p2.second]; ll d = Di[i] + cc; if (Di[j] > d) { Di[j] = d; mae[j] = { i, p2.second }; que.push(mp(d, j)); } } } int tmp = N; while (mae[tmp].first) { C[mae[tmp].second] = D[mae[tmp].second]; tmp = mae[tmp].first; } ll are = Di[N]; rep1(i, N) Di[i] = 1e18; Di[1] = 0; que.push(mp(0, 1)); while (que.size()) { PT p = que.top(); que.pop(); int i = p.second; if (Di[i] != p.first) continue; for (PT p2 : E[i]) { int j = p2.first; int cc = C[p2.second]; int dd = C[p2.second]; ll d = Di[i] + cc; if (Di[j] > d) { Di[j] = d; mae[j] = { i, p2.second }; que.push(mp(d, j)); } } } co(are + Di[N]); Would you please return 0; }