Submission #574118

# Submission time Handle Problem Language Result Execution time Memory
574118 2022-06-07T21:56:38 Z imsifile Computer Network (BOI14_network) C++17
100 / 100
108 ms 7908 KB
#include "network.h"

int dd[1010];

int ping(int, int);
void travelTo(int);

void findRoute(int N, int a, int b)
{
	for (int i = 1; i <= N; i++)
		dd[i] = i != b ? ping(i, b) + 1 : 0;
	int pv = a;
	for (int i = 1; i <= N; i++)
	{
		for (int j = 1; j <= N; j++)
		{
			if (dd[pv] != dd[j] + 1)
				continue;
			if (ping(pv, j) == 0)
			{
				travelTo(j);
				pv = j;
				break;
			}
		}
		if (pv == b)
			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]
   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 time Memory Grader output
1 Correct 107 ms 4176 KB Output is correct
2 Correct 98 ms 7452 KB Output is correct
3 Correct 84 ms 6960 KB Output is correct
4 Correct 81 ms 7020 KB Output is correct
5 Correct 81 ms 6620 KB Output is correct
6 Correct 80 ms 6668 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 292 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 4188 KB Output is correct
2 Correct 20 ms 2728 KB Output is correct
3 Correct 96 ms 7732 KB Output is correct
4 Correct 76 ms 6132 KB Output is correct
5 Correct 83 ms 7812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 102 ms 4148 KB Output is correct
2 Correct 27 ms 2692 KB Output is correct
3 Correct 87 ms 7744 KB Output is correct
4 Correct 75 ms 6168 KB Output is correct
5 Correct 86 ms 7864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 4148 KB Output is correct
2 Correct 21 ms 2772 KB Output is correct
3 Correct 108 ms 7704 KB Output is correct
4 Correct 83 ms 6168 KB Output is correct
5 Correct 107 ms 7908 KB Output is correct