# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29179 | 2017-07-18T15:06:12 Z | aybala | Crocodile's Underground City (IOI11_crocodile) | C++11 | 366 ms | 119584 KB |
#include "crocodile.h" #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[1004]; int ex[1004]; int a[1004]; pll dis[1004]; ll inff = 100000000009; pq< pll >q; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { int i,j,k; fori(i,0,N){ dis[i].fi=inff; dis[i].se=inff; } fori(i,0,M){ v[R[i][0]].pb(mp(R[i][1],L[i])); v[R[i][1]].pb(mp(R[i][0],L[i])); } fori(i,0,K){ ex[P[i]]++; dis[P[i]].fi=0; dis[P[i]].se=0; } fori(i,0,N){ q.push(mp(-dis[i].fi,i)); } while(!q.empty()){ int t=q.top().se; int s=v[t].size(); fori(i,0,s){ if(dis[v[t][i].fi].fi>dis[t].fi+(long long)v[t][i].se){ dis[v[t][i].fi].fi=dis[t].fi+(long long)v[t][i].se; if(dis[v[t][i].fi].fi<dis[v[t][i].fi].se){ ll asd = dis[v[t][i].fi].fi; dis[v[t][i].fi].fi=dis[v[t][i].fi].se; dis[v[t][i].fi].se=asd; } q.push(mp(-dis[v[t][i].fi].fi,v[t][i].fi)); } } q.pop(); } return dis[0].fi; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 119452 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 119584 KB | Output is correct |
2 | Incorrect | 0 ms | 119452 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 366 ms | 119452 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |