# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
261859 | 2020-08-12T06:44:39 Z | Sakamotoo | Crocodile's Underground City (IOI11_crocodile) | C++14 | 908 ms | 74472 KB |
#include "crocodile.h" #include<bits/stdc++.h> using namespace std; #define mp make_pair #define fi first #define se second int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]){ priority_queue<long long> jar[n+10]; vector<pair<long long, long long> > adj[n+10]; for(int i=0; i<m; i++){ adj[r[i][0]].push_back(mp(r[i][1],l[i])); adj[r[i][1]].push_back(mp(r[i][0],l[i])); } priority_queue<pair<long long, long long> > pq; for(int i=0; i<k; i++){ jar[p[i]].push(0); jar[p[i]].push(0); pq.push(mp(0,p[i])); } while(!pq.empty()){ long long x=-pq.top().fi,y=pq.top().se; pq.pop(); if(jar[y].top()<x) continue; if(x>1e9) continue; for(int i=0; i<adj[y].size(); i++){ long long ind=adj[y][i].fi,cost=adj[y][i].se; if(jar[ind].size()<2){ jar[ind].push(x+cost); if(jar[ind].size()==2){ pq.push(mp(-jar[ind].top(),ind)); } }else{ if(jar[ind].top()>x+cost){ jar[ind].pop(); jar[ind].push(x+cost); pq.push(mp(-jar[ind].top(),ind)); } } } } return jar[0].top(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 512 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 512 KB | Output is correct |
8 | Correct | 1 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 512 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 512 KB | Output is correct |
8 | Correct | 1 ms | 512 KB | Output is correct |
9 | Correct | 3 ms | 640 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 512 KB | Output is correct |
12 | Correct | 4 ms | 896 KB | Output is correct |
13 | Correct | 4 ms | 1024 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 512 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 512 KB | Output is correct |
8 | Correct | 1 ms | 512 KB | Output is correct |
9 | Correct | 3 ms | 640 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 512 KB | Output is correct |
12 | Correct | 4 ms | 896 KB | Output is correct |
13 | Correct | 4 ms | 1024 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 512 KB | Output is correct |
16 | Correct | 648 ms | 65672 KB | Output is correct |
17 | Correct | 108 ms | 19064 KB | Output is correct |
18 | Correct | 176 ms | 20600 KB | Output is correct |
19 | Correct | 908 ms | 74472 KB | Output is correct |
20 | Correct | 374 ms | 52216 KB | Output is correct |
21 | Correct | 52 ms | 8056 KB | Output is correct |
22 | Incorrect | 435 ms | 49656 KB | Output isn't correct |