답안 #47308

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
47308 2018-04-30T13:31:57 Z ista2000 컴퓨터 네트워크 (BOI14_network) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
// #define int long long int

#include "network.h"

void findRoute (int N, int a, int b)
{
    /*
     *  Obviously, this is not a good solution.
     *  Replace it with your own code.
     */

    vector<int> v(n);
	for(int i = 0;i<n;i++)
		if(i!=b-1)
			v[i] = ping(i+1, b);
	int cur = a-1;
	while(cur!=b-1)
	{
		for(int i = 0;i<n;i++)
		{
			if(v[i]==v[cur]-1)
			{
				int x = ping(cur+1, i+1);
				if(!x)
				{
					travelTo(i+1);
					cur = i;
					break;
				}
			}
		}
	}
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:14:19: error: 'n' was not declared in this scope
     vector<int> v(n);
                   ^
grader.c: In function 'int main()':
grader.c:48:11: 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:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &distance[u][v]);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~