답안 #65738

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
65738 2018-08-08T16:12:15 Z MiricaMatei 컴퓨터 네트워크 (BOI14_network) C++14
컴파일 오류
0 ms 0 KB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;
vector<int>d[1005];

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

  while (a != b) {
    dist--;
    for (auto it:d[dist])
      if (ping(it, a) == 1) {
        travelTo(it);
        a = it;
        break;
      }
  }
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:9:24: error: 'n' was not declared in this scope
   for (int i = 1; i <= n; ++i) {
                        ^
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]);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~