답안 #559444

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
559444 2022-05-09T20:30:48 Z Sam_a17 컴퓨터 네트워크 (BOI14_network) C++14
100 / 100
95 ms 7912 KB
#include <bits/stdc++.h>
#include "network.h"
using namespace std;

const int M = 1e3 + 10;
vector<int> adj[M];

void findRoute (int N, int a, int b) {
  /*
  int dist = ping(a, b);
  for (int i = 1; i <= dist; ++i)
  travelTo(i);
  */

  int maxi = ping(a, b);
  for(int i = 1; i <= N; i++) {
    if(i == a || i == b) {
      continue;
    }
    int dist = ping(i, b);
    if(dist < maxi) {
      adj[dist].push_back(i);
    }
  }

  int curr = a;
  for(int i = maxi - 1; i >= 0; i--) {
    for(auto j: adj[i]) {
      if(!ping(curr, j)) {
        travelTo(j);
        curr = j;
        break;
      }
    }
  }

  travelTo(b);
}

Compilation message

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]
   48 |     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]
   51 |             scanf("%d", &distance[u][v]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 95 ms 4172 KB Output is correct
2 Correct 89 ms 7440 KB Output is correct
3 Correct 80 ms 7004 KB Output is correct
4 Correct 80 ms 7124 KB Output is correct
5 Correct 94 ms 6672 KB Output is correct
6 Correct 93 ms 6600 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 80 ms 4172 KB Output is correct
2 Correct 21 ms 2784 KB Output is correct
3 Correct 95 ms 7784 KB Output is correct
4 Correct 87 ms 6156 KB Output is correct
5 Correct 85 ms 7888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 86 ms 4268 KB Output is correct
2 Correct 21 ms 2776 KB Output is correct
3 Correct 87 ms 7828 KB Output is correct
4 Correct 84 ms 6196 KB Output is correct
5 Correct 86 ms 7912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 95 ms 4212 KB Output is correct
2 Correct 30 ms 2764 KB Output is correct
3 Correct 93 ms 7760 KB Output is correct
4 Correct 79 ms 6144 KB Output is correct
5 Correct 91 ms 7864 KB Output is correct