답안 #16397

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
16397 2015-08-22T10:34:16 Z comet 악어의 지하 도시 (IOI11_crocodile) C++
컴파일 오류
0 ms 0 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;
bool visit[100000];
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;
	}
	int v,dist;
	while(!Q.empty()){
		do{
			v=Q.top().second;
			dist=-Q.top().first;
			Q.pop();
		}while(visit[v]);
		visit[v]=1;
		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];
}

Compilation message

crocodile.cpp:9:17: error: ‘>>’ should be ‘> >’ within a nested template argument list
 vector<vector<pp>> path;
                 ^
crocodile.cpp: In function ‘int travel_plan(int, int, int (*)[2], int*, int, int*)’:
crocodile.cpp:33:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<path[v].size();i++){
                ^