Submission #216921

# Submission time Handle Problem Language Result Execution time Memory
216921 2020-03-28T12:44:50 Z shashwatchandra Computer Network (BOI14_network) C++17
100 / 100
148 ms 8132 KB
#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--;
		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

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 time Memory Grader output
1 Correct 139 ms 4600 KB Output is correct
2 Correct 136 ms 7416 KB Output is correct
3 Correct 120 ms 7132 KB Output is correct
4 Correct 124 ms 7032 KB Output is correct
5 Correct 118 ms 6776 KB Output is correct
6 Correct 117 ms 6740 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 120 ms 4600 KB Output is correct
2 Correct 32 ms 2936 KB Output is correct
3 Correct 135 ms 7928 KB Output is correct
4 Correct 106 ms 6264 KB Output is correct
5 Correct 134 ms 8056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 127 ms 4684 KB Output is correct
2 Correct 32 ms 2944 KB Output is correct
3 Correct 148 ms 7928 KB Output is correct
4 Correct 108 ms 6264 KB Output is correct
5 Correct 135 ms 8132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 143 ms 4600 KB Output is correct
2 Correct 32 ms 2936 KB Output is correct
3 Correct 134 ms 7980 KB Output is correct
4 Correct 112 ms 6264 KB Output is correct
5 Correct 144 ms 8092 KB Output is correct