Submission #752460

# Submission time Handle Problem Language Result Execution time Memory
752460 2023-06-03T03:50:30 Z salmon Computer Network (BOI14_network) C++14
0 / 100
76 ms 4192 KB
#include "network.h"

#include <bits/stdc++.h>
using namespace std;

void findRoute (int N, int a, int b){
    int dist[N + 5];
	vector<pair<int,int>> v;
    
    for(int i = 1; i < N; i++){
		if(i != a && i != b){
			dist[i] = ping(i,b) + 1;
			v.push_back(make_pair(dist[i],i));
		}
		else{
			dist[i] = 10000;
		}
	}
	
	int d = N;
	
	sort(v.begin(),v.end(),greater<pair<int,int>>());
	
	for(int i = 0; i < N - 1; i++){
		if(v[i].first == d){
			continue;
		}
		
		if(ping(v[i].second,a) == 1){
			a = v[i].second;
			d--;
			travelTo(a);
		}
	}
	
	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 Incorrect 74 ms 4128 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 72 ms 4192 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 4140 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 4124 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -