Submission #29360

#TimeUsernameProblemLanguageResultExecution timeMemory
29360aybalaCrocodile's Underground City (IOI11_crocodile)C++11
0 / 100
396 ms123848 KiB
#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[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 || dis[v[t][i].se]==-1){ dis[v[t][i].se]=dis[t]+v[t][i].fi; q.push(mp(-dis[v[t][i].se],v[t][i].se)); } } ex[v[t][i].se]++; } } return dis[0]; }

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:23:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j,k;
        ^
crocodile.cpp:23:10: warning: unused variable 'k' [-Wunused-variable]
  int i,j,k;
          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...