Submission #1338969

#TimeUsernameProblemLanguageResultExecution timeMemory
1338969luvqroseComputer Network (BOI14_network)C++20
100 / 100
51 ms4360 KiB
#include "network.h"
#include <bits/stdc++.h>

using namespace std;

void findRoute (int N, int a, int b)
{
    int dist = ping(a, b), cd, cu;
    stack<int> s;
    vector<int> adj[dist+1];
    for (int i=1; i<=N; i++)
    {
        if (i==a) continue;
        cd=ping(a, i);
        if (cd<dist) adj[cd].push_back(i);
    }
    cu=b;
    for (int i=dist; i>=0; i--)
    {
        for (auto c : adj[i])
        {
            if (ping(cu, c)==0)
            {
                s.push(c);
                cu=c;
                break;
            }
        }
    }
    while (!s.empty()) travelTo(s.top()), s.pop();
    travelTo(b);
}

Compilation message (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...