답안 #16396

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
16396 2015-08-22T10:29:33 Z comet 악어의 지하 도시 (IOI11_crocodile) C++
0 / 100
600 ms 148812 KB
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#include<cstring>
using namespace std;
typedef pair<int,int> pp;
typedef vector<pp> vec;
vector<vector<pp> > path;
int d[100000][2],INF;
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));
	INF=d[0][0];
	for(int i=0;i<M;i++){
		path[R[i][0]].push_back(pp(R[i][1],L[i]));
		path[R[i][1]].push_back(pp(R[i][0],L[i]));
	}
	priority_queue<pp> Q;
	for(int i=0;i<K;i++){
		Q.push(pp(0,P[i]));
		d[P[i]][1]=d[P[i]][0]=0;
	}
	while(!Q.empty()){
		int v=Q.top().second;
		int dist=-Q.top().first;
		Q.pop();
		for(int i=0;i<path[v].size();i++){
			int u=path[v][i].first;
			int c=path[v][i].second;
			if(d[u][0]>=dist+c){
				swap(d[u][0],d[u][1]);
				d[u][0]=dist+c;
				if(d[u][1]<INF)Q.push(pp(-d[u][1],u));
			}
			else if(d[u][1]>dist+c){
				d[u][1]=dist+c;
				Q.push(pp(-d[u][1],u));
			}
		}
	}
	return d[0][1];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 119744 KB Output is correct
2 Correct 0 ms 119744 KB Output is correct
3 Incorrect 0 ms 119744 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 119876 KB Output is correct
2 Correct 0 ms 119744 KB Output is correct
3 Incorrect 0 ms 119744 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 600 ms 148812 KB Output isn't correct
2 Halted 0 ms 0 KB -