# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
198555 | 2020-01-26T14:48:14 Z | alexandra_udristoiu | Crocodile's Underground City (IOI11_crocodile) | C++14 | 2000 ms | 56256 KB |
#include "crocodile.h" #include<iostream> #include<vector> #define DIM 100005 #define f first #define s second using namespace std; static int viz[DIM]; static pair<int, int> d[DIM]; static vector< pair<int, int> > v[DIM]; int travel_plan(int n, int m, int r[][2], int L[], int k, int p[]){ int i, nod, ii, vecin; for(i = 1; i <= n; i++){ d[i].f = d[i].s = 1000000000; } for(i = 0; i < k; i++){ p[i]++; d[ p[i] ] = make_pair(0, 0); } for(i = 0; i < m; i++){ r[i][0]++; r[i][1]++; v[ r[i][0] ].push_back( make_pair(r[i][1], L[i]) ); v[ r[i][1] ].push_back( make_pair(r[i][0], L[i]) ); } d[0].s = 1000000001; for(ii = 1; ii <= n; ii++){ nod = 0; for(i = 1; i <= n; i++){ if(viz[i] == 0 && d[nod].s > d[i].s){ nod = i; } } viz[nod] = 1; for(i = 0; i < v[nod].size(); i++){ vecin = v[nod][i].f; if(d[vecin].f > d[nod].s + v[nod][i].s){ d[vecin].s = d[vecin].f; d[vecin].f = d[nod].s + v[nod][i].s; } else{ if(d[vecin].s > d[nod].s + v[nod][i].s){ d[vecin].s = d[nod].s + v[nod][i].s; } } } } return d[1].s; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 2680 KB | Output is correct |
2 | Correct | 6 ms | 2680 KB | Output is correct |
3 | Correct | 7 ms | 2680 KB | Output is correct |
4 | Correct | 9 ms | 2808 KB | Output is correct |
5 | Correct | 9 ms | 2808 KB | Output is correct |
6 | Correct | 8 ms | 2680 KB | Output is correct |
7 | Correct | 9 ms | 2808 KB | Output is correct |
8 | Correct | 9 ms | 2808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 2680 KB | Output is correct |
2 | Correct | 6 ms | 2680 KB | Output is correct |
3 | Correct | 7 ms | 2680 KB | Output is correct |
4 | Correct | 9 ms | 2808 KB | Output is correct |
5 | Correct | 9 ms | 2808 KB | Output is correct |
6 | Correct | 8 ms | 2680 KB | Output is correct |
7 | Correct | 9 ms | 2808 KB | Output is correct |
8 | Correct | 9 ms | 2808 KB | Output is correct |
9 | Correct | 9 ms | 3064 KB | Output is correct |
10 | Correct | 7 ms | 2680 KB | Output is correct |
11 | Correct | 8 ms | 2808 KB | Output is correct |
12 | Correct | 11 ms | 3108 KB | Output is correct |
13 | Correct | 10 ms | 3192 KB | Output is correct |
14 | Correct | 7 ms | 2680 KB | Output is correct |
15 | Correct | 8 ms | 2808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 2680 KB | Output is correct |
2 | Correct | 6 ms | 2680 KB | Output is correct |
3 | Correct | 7 ms | 2680 KB | Output is correct |
4 | Correct | 9 ms | 2808 KB | Output is correct |
5 | Correct | 9 ms | 2808 KB | Output is correct |
6 | Correct | 8 ms | 2680 KB | Output is correct |
7 | Correct | 9 ms | 2808 KB | Output is correct |
8 | Correct | 9 ms | 2808 KB | Output is correct |
9 | Correct | 9 ms | 3064 KB | Output is correct |
10 | Correct | 7 ms | 2680 KB | Output is correct |
11 | Correct | 8 ms | 2808 KB | Output is correct |
12 | Correct | 11 ms | 3108 KB | Output is correct |
13 | Correct | 10 ms | 3192 KB | Output is correct |
14 | Correct | 7 ms | 2680 KB | Output is correct |
15 | Correct | 8 ms | 2808 KB | Output is correct |
16 | Execution timed out | 2045 ms | 56256 KB | Time limit exceeded |
17 | Halted | 0 ms | 0 KB | - |