Submission #752462

#TimeUsernameProblemLanguageResultExecution timeMemory
752462salmonComputer Network (BOI14_network)C++14
0 / 100
94 ms4192 KiB
#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 - 2; i++){
		if(v[i].first == d){
			continue;
		}
		
		if(ping(v[i].second,a) + 1== 1){
			a = v[i].second;
			d--;
			travelTo(a);
		}
	}
	
	travelTo(b);
}

Compilation message (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...