답안 #16044

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
16044 2015-08-10T11:56:16 Z kaTkaHr 컴퓨터 네트워크 (BOI14_network) C++
컴파일 오류
0 ms 0 KB
#include "network.h"
#include<vector>

using namespace std;

const int MX = 1005;

vector<int> G[MX];

void findRoute (int N, int a, int b)
{
	int D = ping(a, b) + 1;
	for (int i = 1; i <= N; i++){
		if (i == b) G[0].push_back(b);
		else if( i != a ) G[ping(b, i) + 1].push_back(i);
		else G[D].push_back(i);
	}
	int nw = a;
	for (int i = 1;; i++){
		int nxt = -1;
		for (int c : G[D-i]){
			if (ping(nw, c) == 0){
				nxt = c;
				if (nxt == b){
					travelTo(nxt);
					return;
				}
			}
		}
		nw = nxt;
		travelTo(nxt);
	}
}

Compilation message

network.cpp: In function ‘void findRoute(int, int, int)’:
network.cpp:21:16: error: range-based ‘for’ loops are not allowed in C++98 mode
   for (int c : G[D-i]){
                ^
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]);
                                         ^