# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
740260 | 2023-05-12T08:39:36 Z | abczz | Crocodile's Underground City (IOI11_crocodile) | C++14 | 2 ms | 2772 KB |
#include "crocodile.h" #include <iostream> #include <vector> #include <array> #include <queue> #define ll long long using namespace std; vector <array<ll, 2> > adj[100000]; priority_queue <array<ll, 2>, vector<array<ll, 2>>, greater<array<ll,2>>> pq; ll dist[100000], in[100000], X[100000]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for (int i=0; i<N; ++i) dist[i] = 1e18; for (int i=0; i<M; ++i) { adj[R[i][0]].push_back({R[i][1], L[i]}); adj[R[i][1]].push_back({R[i][0], L[i]}); } for (int i=0; i<K; ++i) { dist[P[i]] = 0; pq.push({0, P[i]}); } while (!pq.empty()) { auto [w, u] = pq.top(); pq.pop(); if (dist[u] != w) continue; for (auto [v, x] : adj[u]) { if (dist[v] > dist[u]+x) { ++in[v]; if (in[v] == 1) X[v] = dist[u]+x; else if (in[v] == 2) { dist[v] = max(X[v], dist[u]+x); pq.push({dist[v], v}); } else { dist[v] = dist[u]+x; pq.push({dist[v], v}); } } } } return dist[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 2 ms | 2668 KB | Output is correct |
3 | Incorrect | 2 ms | 2772 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 2 ms | 2668 KB | Output is correct |
3 | Incorrect | 2 ms | 2772 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 2 ms | 2668 KB | Output is correct |
3 | Incorrect | 2 ms | 2772 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |