# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
805534 | 2023-08-03T17:36:45 Z | QwertyPi | Crocodile's Underground City (IOI11_crocodile) | C++14 | 702 ms | 67636 KB |
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 11; struct Best2{ int a = 1 << 30, b = (1 << 30); int qry(){ return b; } void upd(int x){ if(x <= a) b = a, a = x; else if(x <= b) b = x; } } best[MAXN]; int t[MAXN]; vector<pair<int, int>> G[MAXN]; priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; void extend(int v){ for(auto [u, w] : G[v]){ best[u].upd(t[v] + w); pq.push({best[u].qry(), u}); } } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ fill(t, t + N, 1 << 30); for(int i = 0; i < M; i++){ G[R[i][0]].push_back({R[i][1], L[i]}); G[R[i][1]].push_back({R[i][0], L[i]}); } for(int i = 0; i < K; i++){ int v = P[i]; t[v] = 0; extend(v); } while(!pq.empty()){ auto [d, v] = pq.top(); pq.pop(); if(best[v].qry() != d || t[v] != (1 << 30)) continue; t[v] = best[v].qry(); extend(v); } return t[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Correct | 2 ms | 2672 KB | Output is correct |
4 | Correct | 2 ms | 2672 KB | Output is correct |
5 | Correct | 2 ms | 2672 KB | Output is correct |
6 | Correct | 2 ms | 2680 KB | Output is correct |
7 | Correct | 3 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2772 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Correct | 2 ms | 2672 KB | Output is correct |
4 | Correct | 2 ms | 2672 KB | Output is correct |
5 | Correct | 2 ms | 2672 KB | Output is correct |
6 | Correct | 2 ms | 2680 KB | Output is correct |
7 | Correct | 3 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2772 KB | Output is correct |
9 | Correct | 4 ms | 3028 KB | Output is correct |
10 | Correct | 2 ms | 2644 KB | Output is correct |
11 | Correct | 3 ms | 2772 KB | Output is correct |
12 | Correct | 8 ms | 3156 KB | Output is correct |
13 | Correct | 5 ms | 3284 KB | Output is correct |
14 | Correct | 2 ms | 2644 KB | Output is correct |
15 | Correct | 3 ms | 2772 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Correct | 2 ms | 2672 KB | Output is correct |
4 | Correct | 2 ms | 2672 KB | Output is correct |
5 | Correct | 2 ms | 2672 KB | Output is correct |
6 | Correct | 2 ms | 2680 KB | Output is correct |
7 | Correct | 3 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2772 KB | Output is correct |
9 | Correct | 4 ms | 3028 KB | Output is correct |
10 | Correct | 2 ms | 2644 KB | Output is correct |
11 | Correct | 3 ms | 2772 KB | Output is correct |
12 | Correct | 8 ms | 3156 KB | Output is correct |
13 | Correct | 5 ms | 3284 KB | Output is correct |
14 | Correct | 2 ms | 2644 KB | Output is correct |
15 | Correct | 3 ms | 2772 KB | Output is correct |
16 | Correct | 605 ms | 64540 KB | Output is correct |
17 | Correct | 97 ms | 14992 KB | Output is correct |
18 | Correct | 107 ms | 16708 KB | Output is correct |
19 | Correct | 702 ms | 67636 KB | Output is correct |
20 | Correct | 414 ms | 53804 KB | Output is correct |
21 | Correct | 41 ms | 8152 KB | Output is correct |
22 | Correct | 411 ms | 46624 KB | Output is correct |