답안 #6994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
6994 2014-07-12T08:04:15 Z gs13068 악어의 지하 도시 (IOI11_crocodile) C++
컴파일 오류
0 ms 0 KB
#include<vector>
#include<queue>

std::vector<std::pair<int,int> > G[100000];
std::priority_queue<std::pair<int,int> > PQ;
std::pair<int,int> P;
int D[100000];

int travel_plan(int N,int M,int R[][2],int L[],int K,int P[])
{
    int i;
    for(i=0;i<N;i++)
	{
		G[i].clear();
		D[i]=-1;
	}
    for(i=0;i<M;i++)
	{
		G[R[i][0]].push_back(std::make_pair(R[i][1],L[i]));
		G[R[i][1]].push_back(std::make_pair(R[i][0],L[i]));
	}
	for(i=0;i<K;i++)
	{
        D[P[i]]=-2;
		PQ.insert(std::make_pair(0,P[i]));
	}
    while(!PQ.empty())
	{
		P=PQ.top();
		PQ.pop();
		if(D[P.second]>=0)continue;
		if(D[P.second]==-1)
		{
			D[P.second]=-2;
			continue;
		}
		D[P.second]=-P.first;
        for(i=0;i<G[P.second].size();i++)PQ.insert(std::make_pair(P.first-G[P.second][i].second,G[P.second][i].first));
	}
	return D[0];
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:25:6: error: 'class std::priority_queue<std::pair<int, int> >' has no member named 'insert'
crocodile.cpp:29:12: error: cannot convert 'const std::pair<int, int>' to 'int*' in assignment
crocodile.cpp:31:10: error: request for member 'second' in 'P', which is of non-class type 'int*'
crocodile.cpp:32:10: error: request for member 'second' in 'P', which is of non-class type 'int*'
crocodile.cpp:34:8: error: request for member 'second' in 'P', which is of non-class type 'int*'
crocodile.cpp:37:7: error: request for member 'second' in 'P', which is of non-class type 'int*'
crocodile.cpp:37:18: error: request for member 'first' in 'P', which is of non-class type 'int*'
crocodile.cpp:38:23: error: request for member 'second' in 'P', which is of non-class type 'int*'
crocodile.cpp:38:45: error: 'class std::priority_queue<std::pair<int, int> >' has no member named 'insert'
crocodile.cpp:38:69: error: request for member 'first' in 'P', which is of non-class type 'int*'
crocodile.cpp:38:79: error: request for member 'second' in 'P', which is of non-class type 'int*'
crocodile.cpp:38:101: error: request for member 'second' in 'P', which is of non-class type 'int*'