Submission #45095

# Submission time Handle Problem Language Result Execution time Memory
45095 2018-04-11T09:02:21 Z nibnalin Computer Network (BOI14_network) C++17
50 / 100
172 ms 24088 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] && ping(cur, i) == 0)
			{
				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 Incorrect 122 ms 4260 KB Too many calls to ping
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 156 ms 4456 KB Output is correct
2 Correct 28 ms 4456 KB Output is correct
3 Correct 129 ms 8564 KB Output is correct
4 Correct 107 ms 10512 KB Output is correct
5 Correct 136 ms 14324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 108 ms 14324 KB Output is correct
2 Correct 38 ms 14324 KB Output is correct
3 Correct 122 ms 18408 KB Output is correct
4 Correct 172 ms 20484 KB Output is correct
5 Correct 122 ms 24076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 24088 KB Too many calls to ping
2 Halted 0 ms 0 KB -