Submission #1314782

#TimeUsernameProblemLanguageResultExecution timeMemory
1314782norrawichzzzComputer Network (BOI14_network)C++20
0 / 100
51 ms4348 KiB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;

void findRoute (int N, int a, int b)
{
    /*
     *  Obviously, this is not a good solution.
     *  Replace it with your own code.
     */

    int dist= ping(a,b), prv=a;
    vector<int> ans;
    
    vector<int> fa(N+1, -1), tob(N+1, -1);
	
	vector<bool> vst(N+1, false);
	vst[a] = true;
	
    for (int i=0; i<=dist; i++) {
    	for (int j=1; j<=N; j++) {
    		if (vst[j]) continue;
    		
    		if (fa[j] == -1) fa[j] = ping(a, j);
    		if (tob[j] == -1) tob[j] = ping(b, j);
    		
    		if (fa[j] == i && tob[j] == dist-fa[j]-1 && ping(prv, j) == 0) {
    			ans.push_back(j); 
    			vst[j] = true;
    			prv = j;
			}
		}
	}
	
	for (int i=1; i<ans.size(); i++) travelTo(ans[i]);
}

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