Submission #216920

#TimeUsernameProblemLanguageResultExecution timeMemory
216920shashwatchandraComputer Network (BOI14_network)C++17
0 / 100
145 ms8056 KiB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back

const int N = 1001;
vector<int> all[N];

void findRoute (int n, int a, int b)
{
    /*
     *  Obviously, this is not a good solution.
     *  Replace it with your own code.
     */
	int ooh = 0;
	for(int i = 1;i <= n;i++){
		if(i == b)continue;
		int xd = ping(i,b);
		if(i == a)ooh = xd+1;
		all[xd+1].pb(i);
	}
	all[0].pb(b);
	int cur	= a;
	while(cur != b){
		ooh--;
		cout << cur << " " << ooh << endl;
		for(auto v:all[ooh]){
			if(ping(cur,v) == 0){
				cur = v;
				travelTo(v);
				break;
			}
		}
	}
    /*int dist = ping(a, b);
    for (int i = 1; i <= dist; ++i)
        travelTo (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]
     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]
             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...