# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
897793 | 2024-01-03T17:05:27 Z | Trumling | Crocodile's Underground City (IOI11_crocodile) | C++14 | 405 ms | 89880 KB |
#include "crocodile.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define F first #define S second #define enter cout<<'\n'; #define INF 9999999999999999 #define MOD 1000000007 #define round fixed<<setprecision(2)<< int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { vector<vector<pair<ll,ll>>>g(N+1); for(int i=0;i<M;i++) { g[R[i][0]].pb({R[i][1],L[i]}); g[R[i][1]].pb({R[i][0],L[i]}); } priority_queue<pair<ll,ll>>pq; vector<pair<ll,ll>>dist(N+1,{INF,INF}); for(int i=0;i<K;i++) { dist[P[i]]={0,0}; pq.push({0,P[i]}); } while(!pq.empty()) { ll curr=pq.top().S; ll w=-pq.top().F; pq.pop(); if(dist[curr].S<w) continue; for(auto x:g[curr]) { if(dist[x.F].F> w + x.S) { if(dist[x.F].F!=dist[x.F].S) pq.push({-dist[x.F].F,x.F}); swap(dist[x.F].F,dist[x.F].S); dist[x.F].F=w + x.S; // pq.push({-dist[x.F].F,x.F}); continue; } if(dist[x.F].S> w + x.S) { dist[x.F].S=w + x.S; pq.push({-dist[x.F].S,x.F}); } } } return (int) dist[0].S; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4444 KB | Output is correct |
2 | Correct | 1 ms | 4444 KB | Output is correct |
3 | Correct | 1 ms | 4444 KB | Output is correct |
4 | Correct | 1 ms | 4548 KB | Output is correct |
5 | Correct | 1 ms | 4444 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 4444 KB | Output is correct |
8 | Correct | 1 ms | 4444 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4444 KB | Output is correct |
2 | Correct | 1 ms | 4444 KB | Output is correct |
3 | Correct | 1 ms | 4444 KB | Output is correct |
4 | Correct | 1 ms | 4548 KB | Output is correct |
5 | Correct | 1 ms | 4444 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 4444 KB | Output is correct |
8 | Correct | 1 ms | 4444 KB | Output is correct |
9 | Correct | 2 ms | 4700 KB | Output is correct |
10 | Correct | 1 ms | 4444 KB | Output is correct |
11 | Correct | 1 ms | 4700 KB | Output is correct |
12 | Correct | 3 ms | 4956 KB | Output is correct |
13 | Correct | 3 ms | 5212 KB | Output is correct |
14 | Correct | 1 ms | 4696 KB | Output is correct |
15 | Correct | 1 ms | 4444 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4444 KB | Output is correct |
2 | Correct | 1 ms | 4444 KB | Output is correct |
3 | Correct | 1 ms | 4444 KB | Output is correct |
4 | Correct | 1 ms | 4548 KB | Output is correct |
5 | Correct | 1 ms | 4444 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 4444 KB | Output is correct |
8 | Correct | 1 ms | 4444 KB | Output is correct |
9 | Correct | 2 ms | 4700 KB | Output is correct |
10 | Correct | 1 ms | 4444 KB | Output is correct |
11 | Correct | 1 ms | 4700 KB | Output is correct |
12 | Correct | 3 ms | 4956 KB | Output is correct |
13 | Correct | 3 ms | 5212 KB | Output is correct |
14 | Correct | 1 ms | 4696 KB | Output is correct |
15 | Correct | 1 ms | 4444 KB | Output is correct |
16 | Correct | 328 ms | 82204 KB | Output is correct |
17 | Correct | 55 ms | 19284 KB | Output is correct |
18 | Correct | 75 ms | 21840 KB | Output is correct |
19 | Correct | 405 ms | 89880 KB | Output is correct |
20 | Correct | 234 ms | 66384 KB | Output is correct |
21 | Correct | 27 ms | 11056 KB | Output is correct |
22 | Correct | 245 ms | 64292 KB | Output is correct |