# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
753576 | 2023-06-05T14:14:02 Z | nonono | Crocodile's Underground City (IOI11_crocodile) | C++14 | 468 ms | 66880 KB |
#include "crocodile.h" #include "bits/stdc++.h" using namespace std; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ vector<pair<int, int>> adj[N]; 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]}); } int T[N]; for(int i = 0; i < N; i ++) T[i] = 0; priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; for(int i = 0; i < K; i ++){ pq.push({0, P[i]}); T[P[i]] = 1; } while(!pq.empty()){ int u = pq.top().second; int du = pq.top().first; pq.pop(); T[u] ++ ; if(T[u] == 2){ if(!u) return du; for(auto [v, w] : adj[u]){ if(T[v] >= 2) continue ; pq.push({du + w, v}); } } } return -1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 320 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 320 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 3 ms | 596 KB | Output is correct |
10 | Correct | 1 ms | 312 KB | Output is correct |
11 | Correct | 2 ms | 340 KB | Output is correct |
12 | Correct | 5 ms | 980 KB | Output is correct |
13 | Correct | 4 ms | 832 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 320 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 3 ms | 596 KB | Output is correct |
10 | Correct | 1 ms | 312 KB | Output is correct |
11 | Correct | 2 ms | 340 KB | Output is correct |
12 | Correct | 5 ms | 980 KB | Output is correct |
13 | Correct | 4 ms | 832 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 427 ms | 62796 KB | Output is correct |
17 | Correct | 77 ms | 13316 KB | Output is correct |
18 | Correct | 80 ms | 14824 KB | Output is correct |
19 | Correct | 468 ms | 66880 KB | Output is correct |
20 | Correct | 260 ms | 47232 KB | Output is correct |
21 | Correct | 35 ms | 5812 KB | Output is correct |
22 | Correct | 386 ms | 44492 KB | Output is correct |