Submission #165607

# Submission time Handle Problem Language Result Execution time Memory
165607 2019-11-27T16:30:07 Z Peacher29 Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
2 ms 376 KB
#include "crocodile.h"
#include<bits/stdc++.h>

using namespace std;

class pont{
public:
	vector<int> hova;
	vector<int> mennyiert;
	long long elso=INT_MAX;
	long long masodik=INT_MAX;
};

vector<pont> p;
priority_queue<pair<int,int>> pq;

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
	p.resize(N);
	for(int i=0;i<M;i++){
		p[R[i][0]].hova.push_back(R[i][1]);
		p[R[i][1]].hova.push_back(R[i][0]);
		p[R[i][0]].mennyiert.push_back(L[i]);
		p[R[i][1]].mennyiert.push_back(L[i]);
	}
	for(int i=0;i<K;i++){
		p[P[i]].elso=0;
		p[P[i]].masodik=0;
		pq.push({0,P[i]});
	}
	while(!pq.empty()){
		int ind = pq.top().second;
		for(int i = 0; i < p[ind].hova.size() ; i ++){
			int hov = p[ind].hova[i];
			if(p[hov].elso > max(p[hov].masodik, p[ind].mennyiert[i] + p[ind].elso)){
				p[hov].elso = max(p[hov].masodik, p[ind].mennyiert[i] + p[ind].elso);
				pq.push({-p[hov].elso,hov});
			}
			if(p[hov].masodik > p[ind].mennyiert[i] + p[ind].elso){
				p[hov].masodik = p[ind].mennyiert[i] + p[ind].elso;
			}
		}
		pq.pop();
	}
return p[0].elso;
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:32:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < p[ind].hova.size() ; i ++){
                  ~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -