답안 #16051

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
16051 2015-08-10T12:17:21 Z kriii 컴퓨터 네트워크 (BOI14_network) C++14
컴파일 오류
0 ms 0 KB
#include "network.h"
#include <vector>
using namespace std;

vector<int> p[1001];

void findRoute (int N, int a, int b)
{
	int dist = ping(a,b);
	for (int i=1;i<=N;i++) if (i != a){
		p[ping(a,i)+1].push_back(i);
	}

	for (int d=1;d<=dist;d++){
		bool ed = 0;
		for (int i=1;i<p[d].size();i++){
			if (ping(a,p[d][i]) == 0){
				if (d + ping(p[d][i],p) == dist){
					travelTo(a=p[d][i]);
					ed = 1;
					break;
				}
			}
		}
		if (!ed) travelTo(a=p[d][0]);
	}
	travelTo(b);
}

Compilation message

network.cpp: In function ‘void findRoute(int, int, int)’:
network.cpp:16:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=1;i<p[d].size();i++){
                 ^
network.cpp:18:27: error: invalid conversion from ‘std::vector<int>*’ to ‘int’ [-fpermissive]
     if (d + ping(p[d][i],p) == dist){
                           ^
In file included from network.cpp:1:0:
network.h:2:5: note: initializing argument 2 of ‘int ping(int, int)’
 int ping (int i, int j);
     ^
grader.c: In function ‘int main()’:
grader.c:48:39: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d%d%d%d", &N, &a, &b, &M);
                                       ^
grader.c:51:41: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &distance[u][v]);
                                         ^