답안 #713949

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
713949 2023-03-23T09:53:54 Z Stickfish 컴퓨터 네트워크 (BOI14_network) C++17
100 / 100
110 ms 7996 KB
#include "network.h"
#include <vector>
using namespace std;

void findRoute (int N, int a, int b) {
    vector<int> depth(N + 1);
    vector<vector<int>> rdepth(N);
    for (int i = 1; i <= N; ++i) {
        if (i != b)
            depth[i] = ping(i, b) + 1;
        rdepth[depth[i]].push_back(i);
    }
    int v = a;
    while (v != b) {
        for (auto u : rdepth[depth[v] - 1]) {
            if (ping(v, u) + 1 == 1) {
                v = u;
                travelTo(v);
                break;
            }
        }
    }
}

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 92 ms 7996 KB Output is correct
2 Correct 93 ms 7348 KB Output is correct
3 Correct 103 ms 6936 KB Output is correct
4 Correct 95 ms 6932 KB Output is correct
5 Correct 94 ms 6672 KB Output is correct
6 Correct 110 ms 6584 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 88 ms 6708 KB Output is correct
2 Correct 19 ms 2772 KB Output is correct
3 Correct 107 ms 7796 KB Output is correct
4 Correct 82 ms 6132 KB Output is correct
5 Correct 87 ms 7888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 6648 KB Output is correct
2 Correct 22 ms 2744 KB Output is correct
3 Correct 89 ms 7828 KB Output is correct
4 Correct 75 ms 6156 KB Output is correct
5 Correct 86 ms 7936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 92 ms 6648 KB Output is correct
2 Correct 20 ms 2768 KB Output is correct
3 Correct 87 ms 7828 KB Output is correct
4 Correct 82 ms 6208 KB Output is correct
5 Correct 84 ms 7944 KB Output is correct