Submission #29185

# Submission time Handle Problem Language Result Execution time Memory
29185 2017-07-18T15:16:26 Z inqr Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
693 ms 171864 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace  std;
vector < pair < int , int > > ed[100005];
vector < int > wtex(100005,INT_MIN);
vector < bool > djikv(100005,0);
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
	for(int i=0;i<M;i++){
		ed[R[i][0]].push_back(make_pair(R[i][1],L[i]));
		ed[R[i][1]].push_back(make_pair(R[i][0],L[i]));
	}
	for(int i=0;i<K;i++){
		wtex[P[i]]=0;
		ed[100004].push_back(make_pair(P[i],0));
	}
	priority_queue < pair < int , int > > djikq;
	djikq.push(make_pair(0,100004));
	wtex[100004]=0;
	while(!djikq.empty()){
		int vn=djikq.top().second;
		int wn=-djikq.top().first;
		djikq.pop();
		//printf("vn=%d wn=%d wtex=%d\n",vn,wn,wtex[vn]);
		if(wtex[vn]==INT_MIN){
			wtex[vn]=-wn;
			//printf("	vn=%d wn=%d wtex=%d\n",vn,wn,wtex[vn]);
			continue;
		}
		if(wtex[vn]<0){
			wtex[vn]=wn;
			//printf("	vn=%d wn=%d wtex=%d\n",vn,wn,wtex[vn]);
		}
		djikv[vn]=1;
		if(vn==0){
			return wtex[vn];
		}
		for(int i=0;i<ed[vn].size();i++){
			if(djikv[ed[vn][i].first]==0){
				djikq.push(make_pair(-(wn+ed[vn][i].second),ed[vn][i].first));
			}
		}
	}
	return -1;
}


Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:38:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<ed[vn].size();i++){
                ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 122140 KB Output is correct
2 Correct 0 ms 122140 KB Output is correct
3 Incorrect 3 ms 122140 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 122428 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 693 ms 171864 KB Output isn't correct
2 Halted 0 ms 0 KB -