답안 #65756

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
65756 2018-08-08T16:43:00 Z MiricaMatei 컴퓨터 네트워크 (BOI14_network) C++14
100 / 100
153 ms 47976 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) + 1;
    if (i == a)
      dist = x;
    d[x].push_back(i);
  }
  d[0].push_back(b);
  while (a != b) {
    dist--;
    for (auto it:d[dist])
      if (ping(it, a) == 0) {
        travelTo(it);
        a = it;
        break;
      }
  }
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:8:7: warning: 'dist' may be used uninitialized in this function [-Wmaybe-uninitialized]
   int dist;
       ^~~~
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]);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 142 ms 4376 KB Output is correct
2 Correct 130 ms 7656 KB Output is correct
3 Correct 151 ms 10536 KB Output is correct
4 Correct 127 ms 13408 KB Output is correct
5 Correct 124 ms 15880 KB Output is correct
6 Correct 112 ms 18396 KB Output is correct
7 Correct 3 ms 18396 KB Output is correct
8 Correct 4 ms 18396 KB Output is correct
9 Correct 2 ms 18396 KB Output is correct
10 Correct 4 ms 18396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 120 ms 18476 KB Output is correct
2 Correct 34 ms 18476 KB Output is correct
3 Correct 134 ms 22588 KB Output is correct
4 Correct 125 ms 24484 KB Output is correct
5 Correct 142 ms 28304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 111 ms 28304 KB Output is correct
2 Correct 29 ms 28304 KB Output is correct
3 Correct 126 ms 32444 KB Output is correct
4 Correct 109 ms 34380 KB Output is correct
5 Correct 144 ms 38248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 124 ms 38292 KB Output is correct
2 Correct 35 ms 38292 KB Output is correct
3 Correct 153 ms 42304 KB Output is correct
4 Correct 124 ms 44180 KB Output is correct
5 Correct 140 ms 47976 KB Output is correct