# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
786062 | 2023-07-18T01:23:42 Z | KN200711 | Crocodile's Underground City (IOI11_crocodile) | C++14 | 413 ms | 100968 KB |
#include "crocodile.h" # include <bits/stdc++.h> # define ll long long # define fi first # define se second using namespace std; bool vis[100001], ct[100001]; ll nw[100001]; vector<pair<int, ll> > edge[100001]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i=0;i<N;i++) { vis[i] = 0; ct[i] = 0; edge[i].clear(); } for(int i=0;i<M;i++) { edge[R[i][0]].push_back(make_pair(R[i][1], L[i])); edge[R[i][1]].push_back(make_pair(R[i][0], L[i])); } for(int i=0;i<K;i++) vis[P[i]] = 1; priority_queue< pair<ll, int> > PQ; for(int i=0;i<K;i++) { for(int c=0;c<edge[P[i]].size();c++) { PQ.push(make_pair(-edge[P[i]][c].se, edge[P[i]][c].fi)); } } while(!PQ.empty()) { ll a = -PQ.top().fi; int b = PQ.top().se; PQ.pop(); if(vis[0]) break; if(vis[b]) continue; if(ct[b]) { nw[b] = a; vis[b] = 1; for(int k=0;k<edge[b].size();k++) { if(!vis[edge[b][k].fi]) PQ.push(make_pair(-a-edge[b][k].se, edge[b][k].fi)); } } else ct[b] = 1; } return nw[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2644 KB | Output is correct |
2 | Correct | 2 ms | 2644 KB | Output is correct |
3 | Correct | 2 ms | 2644 KB | Output is correct |
4 | Correct | 2 ms | 2716 KB | Output is correct |
5 | Correct | 3 ms | 2772 KB | Output is correct |
6 | Correct | 2 ms | 2660 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2676 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2644 KB | Output is correct |
2 | Correct | 2 ms | 2644 KB | Output is correct |
3 | Correct | 2 ms | 2644 KB | Output is correct |
4 | Correct | 2 ms | 2716 KB | Output is correct |
5 | Correct | 3 ms | 2772 KB | Output is correct |
6 | Correct | 2 ms | 2660 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2676 KB | Output is correct |
9 | Correct | 3 ms | 3156 KB | Output is correct |
10 | Correct | 2 ms | 2644 KB | Output is correct |
11 | Correct | 2 ms | 2900 KB | Output is correct |
12 | Correct | 5 ms | 3708 KB | Output is correct |
13 | Correct | 4 ms | 3796 KB | Output is correct |
14 | Correct | 2 ms | 2644 KB | Output is correct |
15 | Correct | 3 ms | 2796 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2644 KB | Output is correct |
2 | Correct | 2 ms | 2644 KB | Output is correct |
3 | Correct | 2 ms | 2644 KB | Output is correct |
4 | Correct | 2 ms | 2716 KB | Output is correct |
5 | Correct | 3 ms | 2772 KB | Output is correct |
6 | Correct | 2 ms | 2660 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2676 KB | Output is correct |
9 | Correct | 3 ms | 3156 KB | Output is correct |
10 | Correct | 2 ms | 2644 KB | Output is correct |
11 | Correct | 2 ms | 2900 KB | Output is correct |
12 | Correct | 5 ms | 3708 KB | Output is correct |
13 | Correct | 4 ms | 3796 KB | Output is correct |
14 | Correct | 2 ms | 2644 KB | Output is correct |
15 | Correct | 3 ms | 2796 KB | Output is correct |
16 | Correct | 413 ms | 97212 KB | Output is correct |
17 | Correct | 58 ms | 16960 KB | Output is correct |
18 | Correct | 70 ms | 19440 KB | Output is correct |
19 | Correct | 391 ms | 100968 KB | Output is correct |
20 | Correct | 263 ms | 84600 KB | Output is correct |
21 | Correct | 31 ms | 9548 KB | Output is correct |
22 | Correct | 355 ms | 64456 KB | Output is correct |