# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062610 | 2024-08-17T09:04:00 Z | stdfloat | Cyberland (APIO23_cyberland) | C++17 | 401 ms | 70224 KB |
#include <bits/stdc++.h> #include "cyberland.h" using namespace std; #define ff first #define ss second #define pii pair<int, int> double solve(int n, int M, int K, int H, vector<int> X, vector<int> Y, vector<int> C, vector<int> a) { vector<pii> E[n]; for (int i = 0; i < M; i++) { E[X[i]].push_back({Y[i], C[i]}); E[Y[i]].push_back({X[i], C[i]}); } queue<int> q; vector<bool> vis0(n); q.push(0); vis0[0] = true; while (!q.empty()) { int x = q.front(); q.pop(); if (x == H) continue; for (auto [i, w] : E[x]) { if (!vis0[i]) { q.push(i); vis0[i] = true; } } } if (!vis0[H]) return -1; vector<vector<double>> dis(n, vector<double>(71, 1e18)); priority_queue<pair<double, pii>> pq; for (int i = 0; i < n; i++) { if (!i || (!a[i] && vis0[i])) { dis[i][0] = 0; pq.push({0, {i, 0}}); } } while (!pq.empty()) { double d = pq.top().ff; d = -d; auto [x, y] = pq.top().ss; pq.pop(); if (d != dis[x][y]) continue; if (x == H) return d; for (auto [i, w] : E[x]) { if (!a[i]) continue; if (d + w < dis[i][y]) { dis[i][y] = d + w; pq.push({-dis[i][y], {i, y}}); } if (a[i] == 2 && y < 70 && (d + w) / 2 < dis[i][y + 1]) { dis[i][y + 1] = (d + w) / 2; pq.push({-dis[i][y + 1], {i, y + 1}}); } } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 604 KB | Correct. |
2 | Correct | 13 ms | 860 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 1116 KB | Correct. |
2 | Correct | 20 ms | 1140 KB | Correct. |
3 | Correct | 27 ms | 1112 KB | Correct. |
4 | Correct | 21 ms | 1232 KB | Correct. |
5 | Correct | 22 ms | 1112 KB | Correct. |
6 | Correct | 19 ms | 7100 KB | Correct. |
7 | Correct | 24 ms | 6952 KB | Correct. |
8 | Correct | 14 ms | 13656 KB | Correct. |
9 | Correct | 18 ms | 568 KB | Correct. |
10 | Correct | 18 ms | 576 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 1008 KB | Correct. |
2 | Correct | 22 ms | 1152 KB | Correct. |
3 | Correct | 20 ms | 1116 KB | Correct. |
4 | Correct | 20 ms | 348 KB | Correct. |
5 | Correct | 20 ms | 344 KB | Correct. |
6 | Correct | 6 ms | 5980 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 368 ms | 44808 KB | Correct. |
2 | Incorrect | 401 ms | 1840 KB | Wrong Answer. |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 1056 KB | Correct. |
2 | Correct | 18 ms | 1116 KB | Correct. |
3 | Correct | 18 ms | 1100 KB | Correct. |
4 | Correct | 19 ms | 6744 KB | Correct. |
5 | Correct | 15 ms | 348 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 1128 KB | Correct. |
2 | Correct | 19 ms | 988 KB | Correct. |
3 | Correct | 28 ms | 7308 KB | Correct. |
4 | Correct | 13 ms | 4424 KB | Correct. |
5 | Correct | 23 ms | 544 KB | Correct. |
6 | Correct | 18 ms | 1092 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 291 ms | 3976 KB | Correct. |
2 | Correct | 38 ms | 4156 KB | Correct. |
3 | Incorrect | 74 ms | 67932 KB | Wrong Answer. |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 287 ms | 3816 KB | Correct. |
2 | Correct | 39 ms | 4156 KB | Correct. |
3 | Correct | 56 ms | 70224 KB | Correct. |
4 | Incorrect | 233 ms | 7836 KB | Wrong Answer. |
5 | Halted | 0 ms | 0 KB | - |