Submission #1315116

#TimeUsernameProblemLanguageResultExecution timeMemory
1315116channkComputer Network (BOI14_network)C++20
100 / 100
52 ms4336 KiB
#include "network.h"
#include <vector>
#include <stack>
using namespace std;

void findRoute (int N, int a, int b)
{
    vector<int> arr(1005);
    for(int i=1;i<=N;i++){  
        if(i!=a) arr[i] = ping(a,i)+1; 
    }
    
    stack<int> stk;
    int curr = b;
    while(curr!=a){
        stk.push(curr);  
        for(int i=1;i<=N;i++){  
            if(arr[i]+1==arr[curr] && ping(curr,i)==0){
                curr = i;
                break;  
            }
        }
    }
    
    while(!stk.empty()){
        travelTo(stk.top());
        stk.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...