Submission #741685

# Submission time Handle Problem Language Result Execution time Memory
741685 2023-05-14T14:37:35 Z TheOpChicken Computer Network (BOI14_network) C++17
0 / 100
108 ms 7884 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);
			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 108 ms 7884 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 6732 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 74 ms 6604 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 6664 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -