Submission #741689

# Submission time Handle Problem Language Result Execution time Memory
741689 2023-05-14T14:41:14 Z TheOpChicken Computer Network (BOI14_network) C++17
100 / 100
121 ms 7948 KB
#include <iostream>
#include <vector>
#include "network.h"
using namespace std;

void findRoute(int n, int a, int b){
	vector<vector<int> > dist(n+5, vector<int>());
	vector<int> length(n+5);
	dist[0].push_back(a);
	for (int i = 1; i <= n; i++){
		if (i == a) continue;
		int len = ping(a, i) + 1;
		dist[len].push_back(i);
		length[i] = len;
	}

	int cur_node = b;
	vector<int> ans;
	for (int i = length[b]; i >= 1; i--){
		ans.push_back(cur_node);
		for (int node: dist[i-1]){
			int len = ping(cur_node, node) + 1;
			if (len == 1){
				cur_node = node;
				break;
			}
		}
	}

	for (int i = ans.size()-1; i >= 0; i--) travelTo(ans[i]);

	return;
}


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 72 ms 4364 KB Output is correct
2 Correct 95 ms 7456 KB Output is correct
3 Correct 80 ms 6936 KB Output is correct
4 Correct 71 ms 6956 KB Output is correct
5 Correct 71 ms 6608 KB Output is correct
6 Correct 73 ms 6636 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 4156 KB Output is correct
2 Correct 20 ms 2752 KB Output is correct
3 Correct 78 ms 7752 KB Output is correct
4 Correct 64 ms 6416 KB Output is correct
5 Correct 72 ms 7916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 4148 KB Output is correct
2 Correct 17 ms 2772 KB Output is correct
3 Correct 121 ms 7776 KB Output is correct
4 Correct 69 ms 6200 KB Output is correct
5 Correct 76 ms 7948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 104 ms 4208 KB Output is correct
2 Correct 19 ms 2788 KB Output is correct
3 Correct 81 ms 7892 KB Output is correct
4 Correct 68 ms 6188 KB Output is correct
5 Correct 74 ms 7924 KB Output is correct