# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
61205 | 2018-07-25T11:13:38 Z | Vahan | Crocodile's Underground City (IOI11_crocodile) | C++17 | 1856 ms | 103160 KB |
#include "crocodile.h" #include<vector> #include<set> using namespace std; #define mp make_pair const long long MAX=100000000000000000; long long d[200000],er[200000],ar[200000]; vector<pair<int,int> > g[200000]; set<pair<long long,long long > > ss; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i=0;i<M;i++) { g[R[i][0]].push_back(mp(R[i][1],L[i])); g[R[i][1]].push_back(mp(R[i][0],L[i])); } for(int i=0;i<N;i++) { ar[i]=MAX; er[i]=MAX; d[i]=MAX; } for(int i=0;i<K;i++) { er[P[i]]=0; ar[P[i]]=0; ss.insert(mp(0,P[i])); } for(int i=0;i<N;i++) { if(ss.empty()) break; int v=ss.begin()->second; ss.erase(ss.begin()); d[v]=er[v]; er[v]=MAX; for(int j=0;j<g[v].size();j++) { int to=g[v][j].first; int dis=g[v][j].second; if(d[to]!=MAX) continue; if(ar[to]>=dis+d[v]) { ss.erase(mp(er[to],to)); er[to]=ar[to]; ss.insert(mp(er[to],to)); ar[to]=dis+d[v]; } else if(er[to]>dis+d[v]) { ss.erase(mp(er[to],to)); er[to]=d[v]+dis; ss.insert(mp(er[to],to)); } } } return d[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4984 KB | Output is correct |
2 | Correct | 7 ms | 5096 KB | Output is correct |
3 | Correct | 8 ms | 5168 KB | Output is correct |
4 | Correct | 7 ms | 5244 KB | Output is correct |
5 | Correct | 9 ms | 5372 KB | Output is correct |
6 | Correct | 9 ms | 5412 KB | Output is correct |
7 | Correct | 9 ms | 5548 KB | Output is correct |
8 | Correct | 8 ms | 5548 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4984 KB | Output is correct |
2 | Correct | 7 ms | 5096 KB | Output is correct |
3 | Correct | 8 ms | 5168 KB | Output is correct |
4 | Correct | 7 ms | 5244 KB | Output is correct |
5 | Correct | 9 ms | 5372 KB | Output is correct |
6 | Correct | 9 ms | 5412 KB | Output is correct |
7 | Correct | 9 ms | 5548 KB | Output is correct |
8 | Correct | 8 ms | 5548 KB | Output is correct |
9 | Correct | 11 ms | 5548 KB | Output is correct |
10 | Correct | 8 ms | 5548 KB | Output is correct |
11 | Correct | 9 ms | 5600 KB | Output is correct |
12 | Correct | 12 ms | 5928 KB | Output is correct |
13 | Correct | 12 ms | 5992 KB | Output is correct |
14 | Correct | 8 ms | 5992 KB | Output is correct |
15 | Correct | 9 ms | 5992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4984 KB | Output is correct |
2 | Correct | 7 ms | 5096 KB | Output is correct |
3 | Correct | 8 ms | 5168 KB | Output is correct |
4 | Correct | 7 ms | 5244 KB | Output is correct |
5 | Correct | 9 ms | 5372 KB | Output is correct |
6 | Correct | 9 ms | 5412 KB | Output is correct |
7 | Correct | 9 ms | 5548 KB | Output is correct |
8 | Correct | 8 ms | 5548 KB | Output is correct |
9 | Correct | 11 ms | 5548 KB | Output is correct |
10 | Correct | 8 ms | 5548 KB | Output is correct |
11 | Correct | 9 ms | 5600 KB | Output is correct |
12 | Correct | 12 ms | 5928 KB | Output is correct |
13 | Correct | 12 ms | 5992 KB | Output is correct |
14 | Correct | 8 ms | 5992 KB | Output is correct |
15 | Correct | 9 ms | 5992 KB | Output is correct |
16 | Correct | 1252 ms | 59692 KB | Output is correct |
17 | Correct | 192 ms | 59692 KB | Output is correct |
18 | Correct | 230 ms | 59692 KB | Output is correct |
19 | Correct | 1856 ms | 89176 KB | Output is correct |
20 | Correct | 490 ms | 91940 KB | Output is correct |
21 | Correct | 73 ms | 91940 KB | Output is correct |
22 | Correct | 611 ms | 103160 KB | Output is correct |