제출 #1314850

#제출 시각아이디문제언어결과실행 시간메모리
1314850kantaponz컴퓨터 네트워크 (BOI14_network)C++20
100 / 100
52 ms4368 KiB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> dist[1005];

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

    stack<int> s;
    int cur = b;

    for (int i = d - 1; i >= 0; i--) {
        for (auto x : dist[i]) {
            if (ping(x, cur) == 0) {
                s.push(x);
                cur = x;
                break;
            }
        }
    }

    while (!s.empty()) {
        travelTo(s.top());
        s.pop();
    }

    travelTo(b);
}

컴파일 시 표준 에러 (stderr) 메시지

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]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...