# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29361 | 2017-07-19T07:08:04 Z | aybala | Crocodile's Underground City (IOI11_crocodile) | C++11 | 383 ms | 123848 KB |
#include<bits/stdc++.h> #define fori(a,b,c) for(a=b; a<c; a++) #define ford(a,b,c) for(a=b; a>=c; a--) #define mp make_pair #define pb push_back #define ll long long #define pii pair<int,int> #define fi first #define se second #define fr front #define emp empty #define pq priority_queue #define pll pair<long,long> using namespace std; vector< pii >v[100005]; int ex[100005]; pq< pii >q; int dis[100005]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ int i,j,k; fori(i,0,N){ v[R[i][0]].pb(mp(L[i],R[i][1])); v[R[i][1]].pb(mp(L[i],R[i][0])); dis[i]=-1; } fori(i,0,K){ ex[P[i]]=1; dis[P[i]]=0; q.push(mp(0,P[i])); } while(!q.empty()){ int t=q.top().se; int s=v[t].size(); q.pop(); fori(i,0,s){ if(ex[v[t][i].se]){ if((dis[v[t][i].se]>dis[t]+v[t][i].fi && ex[v[t][i].se]!=1) || (ex[v[t][i].se]==1 && dis[v[t][i].se]<dis[t]+v[t][i].fi)){ dis[v[t][i].se]=dis[t]+v[t][i].fi; q.push(mp(-dis[v[t][i].se],v[t][i].se)); } } if(ex[v[t][i].se]==0){ dis[v[t][i].se]=dis[t]+v[t][i].fi; } ex[v[t][i].se]++; } } return dis[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 122528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 122528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 383 ms | 123848 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |