답안 #445448

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
445448 2021-07-18T04:11:10 Z blue 컴퓨터 네트워크 (BOI14_network) C++17
25 / 100
107 ms 7344 KB
#include "network.h"
#include <vector>
#include <iostream>
using namespace std;

int getDist(int x, int y)
{
    if(x == y) return 0;
    else
    {
        int P = ping(x, y);
        // cerr << "returning " << P << " for " << x << ", " << y << "\n";
        return P + 1;
    }
}

void findRoute(int N, int a, int b)
{
    int distA[N+1];
    for(int i = 1; i <= N; i++) distA[i] = getDist(a, i);

    vector<int> dist_list[N+1];
    for(int i = 1; i <= N; i++)
    {
        dist_list[ distA[i] ].push_back(i);
    }

    for(int x = 1; x <= distA[b]; x++)
    {
        // cerr << "x = " << x << '\n';
        for(int A:dist_list[ distA[a] + 1 ])
        {
            if(getDist(A, b) == distA[b] - distA[A])
            {
                // cerr << "travelling to " << A << '\n';
                travelTo(A);
                a = A;
                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 106 ms 6344 KB Output is correct
2 Correct 107 ms 7344 KB Output is correct
3 Correct 96 ms 6996 KB Output is correct
4 Correct 97 ms 6940 KB Output is correct
5 Correct 98 ms 6656 KB Output is correct
6 Correct 98 ms 6580 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 105 ms 6316 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 105 ms 6332 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 102 ms 6432 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -