답안 #388595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
388595 2021-04-12T08:24:41 Z mariowong 악어의 지하 도시 (IOI11_crocodile) C++14
컴파일 오류
0 ms 0 KB
#include "crocodile.h"
#include <bits/stdc++.h>

using namespace std;

struct edge{
	long long node,w;
}nw,now;

long long ans;
vector <edge> e[100005];
priority_queue <pair<long long,long long>  > q;
bool vis[100005][5];
long long travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
	for (int i=0;i<M;i++){
		now.w=L[i];
		now.node=R[i][0];	e[R[i][1]].push_back(now);
		nwo.node=R[i][1];	e[R[i][0]].push_back(now);
	}
	for (int i=0;i<K;i++){
		q.push(make_pair(0,P[i]));
		q.push(make_pair(0,P[i]));
	}
	while (!q.empty()){
		now.w=-q.front().first; now.node=q.front().second;
		if (!vis[now.node][0])
		vis[now.node][0]=true;
		else
		if (!vis[now.node][1]){
			vis[now.node][1]=true;
			if (now.node == 0) ans=now.w;
			for (int i=0;i<e[now.node].size();i++){
				if (!vis[e[now.node][i].node][1])
				q.push(make_pair(-(now.w+e[now.node][i].w),e[now.node][i].node));
			}
		}
	}
	return ans;
}

Compilation message

crocodile.cpp:14:11: error: ambiguating new declaration of 'long long int travel_plan(int, int, int (*)[2], int*, int, int*)'
   14 | long long travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
      |           ^~~~~~~~~~~
In file included from crocodile.cpp:1:
crocodile.h:1:5: note: old declaration 'int travel_plan(int, int, int (*)[2], int*, int, int*)'
    1 | int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]);
      |     ^~~~~~~~~~~
crocodile.cpp: In function 'long long int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:18:3: error: 'nwo' was not declared in this scope; did you mean 'now'?
   18 |   nwo.node=R[i][1]; e[R[i][0]].push_back(now);
      |   ^~~
      |   now
crocodile.cpp:25:12: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   25 |   now.w=-q.front().first; now.node=q.front().second;
      |            ^~~~~
crocodile.cpp:25:38: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   25 |   now.w=-q.front().first; now.node=q.front().second;
      |                                      ^~~~~
crocodile.cpp:32:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<edge>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |    for (int i=0;i<e[now.node].size();i++){
      |                 ~^~~~~~~~~~~~~~~~~~~