Submission #741687

# Submission time Handle Problem Language Result Execution time Memory
741687 2023-05-14T14:38:09 Z TheOpChicken Computer Network (BOI14_network) C++17
0 / 100
76 ms 4300 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);
		dist[len].push_back(a);
		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 Incorrect 70 ms 4300 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 4244 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 4248 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 4156 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -