Submission #45094

# Submission time Handle Problem Language Result Execution time Memory
45094 2018-04-11T08:49:49 Z nibnalin Computer Network (BOI14_network) C++17
25 / 100
197 ms 29528 KB
#include <iostream>
#include <cstdio>
#include <vector>
#include "network.h"
using namespace std;

const int maxn = int(1e3)+5;

int D[2][maxn];

void findRoute (int n, int a, int b)
{
	for(int i = 1;i <= n;i++)
	{
		if(i != a) D[0][i] = ping(a, i)+1;
		if(i != b) D[1][i] = ping(b, i)+1;
		//cout << i << " " << D[0][i] << " " << D[1][i] << "\n";
	}

	int cur = a;
	while(cur != b)
	{
		for(int i = 1;i <= n;i++)
		{
			if(D[0][i] == D[0][cur]+1 && D[0][i]+D[1][i] == D[0][b])
			{
				travelTo(i);
				cur = i;
				break;
			}
		}
	}
}

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 125 ms 8024 KB Output is correct
2 Correct 197 ms 11380 KB Output is correct
3 Correct 155 ms 14132 KB Output is correct
4 Correct 108 ms 16928 KB Output is correct
5 Correct 108 ms 19528 KB Output is correct
6 Correct 108 ms 22020 KB Output is correct
7 Correct 2 ms 22020 KB Output is correct
8 Correct 2 ms 22020 KB Output is correct
9 Correct 2 ms 22020 KB Output is correct
10 Correct 2 ms 22020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 24604 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 136 ms 27056 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 120 ms 29528 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -