답안 #397596

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
397596 2021-05-02T13:23:30 Z lyc 컴퓨터 네트워크 (BOI14_network) C++14
100 / 100
119 ms 7900 KB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;

int _ping(int a, int b) {
    if (a == b) return -1;
    return ping(a,b);
}

void findRoute (int N, int a, int b)
{
    int dist[N+1];
    for (int i = 1; i <= N; ++i) {
        dist[i] = _ping(a,i);
    }

    vector<int> v = {b};
    for (int d = dist[b]-1; d >= 0; --d) {
        for (int i = 1; i <= N; ++i) if (dist[i] == d && _ping(v.back(),i) == 0) {
            v.push_back(i);
            break;
        }
    }

    for (int i = (int)v.size()-1; i >= 0; --i) {
        travelTo(v[i]);
    }
}

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 111 ms 4144 KB Output is correct
2 Correct 105 ms 4204 KB Output is correct
3 Correct 101 ms 7016 KB Output is correct
4 Correct 110 ms 6980 KB Output is correct
5 Correct 100 ms 6596 KB Output is correct
6 Correct 100 ms 6652 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 99 ms 4200 KB Output is correct
2 Correct 25 ms 2252 KB Output is correct
3 Correct 110 ms 7748 KB Output is correct
4 Correct 94 ms 6100 KB Output is correct
5 Correct 108 ms 7876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 100 ms 4240 KB Output is correct
2 Correct 25 ms 2244 KB Output is correct
3 Correct 108 ms 7748 KB Output is correct
4 Correct 93 ms 6112 KB Output is correct
5 Correct 109 ms 7900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 100 ms 4168 KB Output is correct
2 Correct 26 ms 2196 KB Output is correct
3 Correct 119 ms 7720 KB Output is correct
4 Correct 95 ms 6160 KB Output is correct
5 Correct 108 ms 7848 KB Output is correct