답안 #218276

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
218276 2020-04-01T19:24:29 Z dolphingarlic 컴퓨터 네트워크 (BOI14_network) C++14
100 / 100
136 ms 8068 KB
#include "network.h"
#include <vector>

int dist[1001];
std::vector<int> from_b[1001];

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

    for (int i = dist[a]; i; i--) {
        for (int j : from_b[i - 1]) if (!ping(a, j)) {
            travelTo(j);
            a = 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]
     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 129 ms 8056 KB Output is correct
2 Correct 130 ms 7544 KB Output is correct
3 Correct 120 ms 7036 KB Output is correct
4 Correct 123 ms 7288 KB Output is correct
5 Correct 113 ms 6776 KB Output is correct
6 Correct 113 ms 6776 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 9 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 119 ms 6776 KB Output is correct
2 Correct 32 ms 2944 KB Output is correct
3 Correct 127 ms 7904 KB Output is correct
4 Correct 106 ms 6264 KB Output is correct
5 Correct 136 ms 7928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 119 ms 6776 KB Output is correct
2 Correct 33 ms 2808 KB Output is correct
3 Correct 133 ms 7928 KB Output is correct
4 Correct 106 ms 6264 KB Output is correct
5 Correct 128 ms 8068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 117 ms 6776 KB Output is correct
2 Correct 32 ms 2808 KB Output is correct
3 Correct 129 ms 7928 KB Output is correct
4 Correct 114 ms 6392 KB Output is correct
5 Correct 128 ms 8060 KB Output is correct