Submission #16394

# Submission time Handle Problem Language Result Execution time Memory
16394 2015-08-22T09:00:11 Z comet Crocodile's Underground City (IOI11_crocodile) C++
0 / 100
592 ms 149008 KB
#include "crocodile.h"
#include<algorithm>
#include<vector>
#include<queue>
#include<cstring>
#define pb push_back
using namespace std;
typedef pair<int,int> pp;
typedef vector<pp> vec;
vector<vec> path;
int d[100000][2];
bool visit[100000][2];
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
	path.assign(N,vec());
	memset(d,0x3f,sizeof(d));
	for(int i=0;i<M;i++){
		path[R[i][0]].pb(pp(R[i][1],L[i]));
		path[R[i][1]].pb(pp(R[i][0],L[i]));
	}
	int INF=d[0][0];
	priority_queue<pp> Q;
	for(int i=0;i<K;i++){
		Q.push(pp(0,P[i]));
		d[P[i]][0]=0;
	}
	int v,c;
	while(!Q.empty()){
		v=Q.top().second;
		c=-Q.top().first;
		Q.pop();
		for(int i=0;i<path[v].size();i++){
			int u=path[v][i].first;
			int w=path[v][i].second;
			if(d[u][0]>=c+w){
				swap(d[u][0],d[u][1]);
				d[u][0]=c+w;
				if(d[u][1]<INF)Q.push(pp(-d[u][1],u));
			}
			else if(d[u][1]>c+w){
				d[u][1]=c+w;
				Q.push(pp(-d[u][1],u));
			}
		}
	}
	return d[0][1];
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 119940 KB Output is correct
2 Correct 0 ms 119940 KB Output is correct
3 Incorrect 0 ms 119940 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 120072 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 592 ms 149008 KB Output isn't correct
2 Halted 0 ms 0 KB -