Submission #1186393

#TimeUsernameProblemLanguageResultExecution timeMemory
118639312345678Computer Network (BOI14_network)C++20
100 / 100
55 ms4224 KiB
#include "network.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=1e3+5;

int mn[nx];

void findRoute (int N, int a, int b)
{
    for (int i=1; i<=N; i++) if (i!=a) mn[i]=ping(a, i)+1;
    stack<int> s;
    int cur=b;
    while (cur!=a)
    {
        s.push(cur);
        for (int i=1; i<=N; i++) 
        {
            if (mn[i]+1==mn[cur]&&ping(cur, i)==0)  
            {
                cur=i;
                break;
            }
        }
    }
    while (!s.empty()) travelTo(s.top()), s.pop();
}

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...