# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
318380 | 2020-11-01T15:23:31 Z | neki | Crocodile's Underground City (IOI11_crocodile) | C++14 | 3 ms | 5100 KB |
#include <bits/stdc++.h> #include "crocodile.h" #define fore(i, a) for(auto&& i:a) #define fi first #define se second #define ps(a) push_back(a) #define pb(a) pop_back(a) #define sc scanf #define vc vector #define pa pair<ll, ll> #define ll long long #define loop(i, a, b) for(ll i=a;i<b;i++) #define pool(i, a, b) for(ll i=a-1;i>=b;i--) #define lb lower_bound #define ub upper_bound #define all(a) a.begin(), a.end() #define llmax LLONG_MAX/2 #define llmin -LLONG_MAX/2 using namespace std; #define mn 200100 #define pa pair<ll, ll> #define ld long double vc<pa> edg[mn]; ll act[mn], dist[mn], vis[mn]; int travel_plan(int n,int m,int r[][2],int l[],int k,int p[]){ loop(i, 0, n) dist[i]=-1; loop(i, 0, m){ edg[r[i][0]].ps(make_pair(r[i][1], l[i])); edg[r[i][1]].ps(make_pair(r[i][0], l[i])); } set<pair<ll, ll>> q;loop(i, 0, k) q.insert({0, p[i]}), act[p[i]]=1, dist[p[i]]=0; while(q.size()){ ll u=q.begin()->se, d=q.begin()->fi; if(u==0) return d; q.erase(q.begin()); if(vis[u])continue; if(!act[u]) act[u]=1; else{ vis[u]=1; dist[u]=d; fore(v, edg[u]) q.insert({dist[u]+v.se, v.fi}); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 5100 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 5100 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 5100 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |