답안 #752464

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
752464 2023-06-03T03:56:03 Z salmon 컴퓨터 네트워크 (BOI14_network) C++14
100 / 100
83 ms 4308 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 = ping(a,b) + 1;
	
	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

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]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 4128 KB Output is correct
2 Correct 81 ms 4164 KB Output is correct
3 Correct 75 ms 4284 KB Output is correct
4 Correct 67 ms 4192 KB Output is correct
5 Correct 69 ms 4196 KB Output is correct
6 Correct 83 ms 4172 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 4212 KB Output is correct
2 Correct 17 ms 2252 KB Output is correct
3 Correct 69 ms 4172 KB Output is correct
4 Correct 64 ms 4204 KB Output is correct
5 Correct 71 ms 4224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 4308 KB Output is correct
2 Correct 20 ms 2272 KB Output is correct
3 Correct 78 ms 4212 KB Output is correct
4 Correct 80 ms 4180 KB Output is correct
5 Correct 78 ms 4120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 4244 KB Output is correct
2 Correct 18 ms 2260 KB Output is correct
3 Correct 80 ms 4172 KB Output is correct
4 Correct 60 ms 4172 KB Output is correct
5 Correct 71 ms 4224 KB Output is correct