Submission #72642

# Submission time Handle Problem Language Result Execution time Memory
72642 2018-08-26T13:06:29 Z TuGSGeReL Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
6 ms 4216 KB
#include "crocodile.h"
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pub push_back
#define pob pop_back
#define ss second
#define ff first
#define ext exit(0)
using namespace std;
ll i,mn1[100001],mn2[100001];
vector<pair<ll,ll> >v[100001];
priority_queue<pair<ll,ll> >q;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
	for(i=0;i<M;i++){
		v[R[i][0]].pub(mp(R[i][1],L[i]));
		v[R[i][1]].pub(mp(R[i][0],L[i]));
	}
	memset(mn2,63,sizeof mn2);
	memset(mn1,63,sizeof mn1);
	for(i=0;i<K;i++){
		q.push(mp(0,P[i]));
		mn1[P[i]]=0;
		mn2[P[i]]=0;
	}
	while(!q.empty()){
		ll idx=q.top().ff,cs=q.top().ss;
		q.pop();
		if(cs>mn2[idx]) continue;
		for(i=0;i<v[idx].size();i++){
			ll idx1=v[idx][i].ff,cst1=v[idx][i].ss;
			ll cstdt=mn2[idx1];
			mn2[idx1]=min(mn2[idx1],cs+cst1);
			if(mn2[idx1]<mn1[idx1])swap(mn2[idx1],mn1[idx1]);
			if(mn2[idx1]!=cstdt) q.push(mp(-mn2[idx1],idx1));
		}
	}
	return mn2[0];
}

Compilation message

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