답안 #467471

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
467471 2021-08-23T05:56:16 Z maeola 컴퓨터 네트워크 (BOI14_network) C++17
100 / 100
102 ms 7928 KB
#include "network.h"
#include <bits/stdc++.h>

using namespace std;

void findRoute (int N, int a, int b)
{
    vector<int> Q(69 + N);
    vector<int> W[69 + N];
    for (int i = 1; i <= N; i++) {
        if(i == b) continue;
        Q[i] = ping(b, i);
        W[Q[i]].push_back(i);
    }

    int dist = Q[a] - 1;
    int cur = a;

    while(dist >= 0) {
        int chosen = -1;
        for (int x : W[dist]) {
            if(ping(cur, x) == 0)
                chosen = x;
        }
        travelTo(chosen);
        cur = chosen;
        dist--;
    }
    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 102 ms 7896 KB Output is correct
2 Correct 96 ms 7432 KB Output is correct
3 Correct 97 ms 6968 KB Output is correct
4 Correct 93 ms 7004 KB Output is correct
5 Correct 93 ms 6636 KB Output is correct
6 Correct 94 ms 6696 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 101 ms 6684 KB Output is correct
2 Correct 24 ms 2796 KB Output is correct
3 Correct 98 ms 7748 KB Output is correct
4 Correct 89 ms 6220 KB Output is correct
5 Correct 100 ms 7920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 94 ms 6596 KB Output is correct
2 Correct 24 ms 2712 KB Output is correct
3 Correct 100 ms 7836 KB Output is correct
4 Correct 91 ms 6168 KB Output is correct
5 Correct 100 ms 7928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 98 ms 6624 KB Output is correct
2 Correct 25 ms 2756 KB Output is correct
3 Correct 101 ms 7804 KB Output is correct
4 Correct 89 ms 6180 KB Output is correct
5 Correct 99 ms 7876 KB Output is correct