Submission #480476

# Submission time Handle Problem Language Result Execution time Memory
480476 2021-10-16T14:30:27 Z dsyz Computer Network (BOI14_network) C++17
100 / 100
114 ms 7896 KB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAXN (1005)

void findRoute (int N, int a, int b){
    int dist = ping(a, b);
    ll from[N + 1];
    for(int i = 1;i <= N;i++){
		if(i != a && i != b){
			int fromend = ping(i,b);
			from[i] = fromend;
		}
	}
	int cur = a;
	int prev = dist;
	int visited[N + 1];
	memset(visited,0,sizeof(visited));
	visited[a] = 1;
	visited[b] = 1;
    for (int w = 0;w < dist;w++){
		for(int i = 1;i <= N;i++){
			if(i == a || i == b){
				continue;
			}
			if(visited[i] == 0 && from[i] == prev - 1 && ping(cur,i) == 0){
				visited[i] = 1;
				prev--;
				cur = i;
				break;
			}
		}
		travelTo(cur);
	}
	travelTo(b);
}

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 91 ms 7876 KB Output is correct
2 Correct 100 ms 7432 KB Output is correct
3 Correct 84 ms 6964 KB Output is correct
4 Correct 95 ms 7012 KB Output is correct
5 Correct 82 ms 6700 KB Output is correct
6 Correct 92 ms 6704 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 94 ms 6620 KB Output is correct
2 Correct 23 ms 2756 KB Output is correct
3 Correct 86 ms 7748 KB Output is correct
4 Correct 78 ms 6088 KB Output is correct
5 Correct 86 ms 7876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 101 ms 6656 KB Output is correct
2 Correct 23 ms 2820 KB Output is correct
3 Correct 98 ms 7696 KB Output is correct
4 Correct 84 ms 6084 KB Output is correct
5 Correct 113 ms 7896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 6628 KB Output is correct
2 Correct 30 ms 2756 KB Output is correct
3 Correct 107 ms 7796 KB Output is correct
4 Correct 114 ms 6084 KB Output is correct
5 Correct 103 ms 7828 KB Output is correct