Submission #29491

#TimeUsernameProblemLanguageResultExecution timeMemory
29491NikeforCrocodile's Underground City (IOI11_crocodile)C++98
0 / 100
816 ms170304 KiB
#include "crocodile.h" #include<bits/stdc++.h> #define ii pair<int,int> using namespace std; int visit[100002]; int res; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { priority_queue<ii, vector<ii>, greater<ii> > q; vector<ii> adj[N+2]; for(int i=0; i<M; i++) { int v1 = R[i][0], v2 = R[i][1]; adj[v1].push_back(make_pair(v2,i)); adj[v2].push_back(make_pair(v1,i)); } for(int i=0; i<K; i++) { q.push(make_pair(0,P[i])); visit[P[i]]++; } while(!q.empty()) { ii e = q.top(); int v = e.second; // printf("%d deyim\n", v); q.pop(); if(!visit[v]) { visit[v]++; continue; } visit[v]++; if(!v){ res = e.first; break; } for(int i=0; i<adj[v].size(); i++) { if(visit[adj[v][i].first]<2) q.push(make_pair(e.first+L[adj[v][i].second], adj[v][i].first )); } } return res; }

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:31:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0; i<adj[v].size(); i++) {
                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...