답안 #17634

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17634 2016-01-05T10:33:51 Z Namnamseo 컴퓨터 네트워크 (BOI14_network) C++14
75 / 100
143 ms 5224 KB
#include "network.h"
#include <vector>
#include <cstdio>

int dist_array[1010];
std::vector<int> points[1010];

void findRoute (int n, int a, int b)
{
	int i, od;
	int total_dist = ping(a,b);
	for(i=1;i<=n;++i) if(i!=a && i!=b) {
		od = ping(b,i);
		dist_array[i]=od;
		points[total_dist-od].push_back(i);
		//printf("%d ~ %d : %d\n",a,i,total_dist-od);
	}
	int current_point = a, current_dist = 0;
	int sz;
	while(true){
		//printf("Current point %d\n",current_point);
		++current_dist;
		if(current_dist == total_dist+1){
			//puts("final");
			travelTo(b);
			break;
		}
		sz=points[current_dist].size();
		for(i=0;i<sz;++i){
			int tmp=points[current_dist][i];
			if(ping(current_point,tmp)==0){
				//printf("trying to go to %d -> %d\n",current_point,tmp);
				current_point=tmp;
				travelTo(current_point);
				break;
			}
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 143 ms 5224 KB Output is correct
2 Runtime error 131 ms 5220 KB Program hung waiting for input
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 5224 KB Output is correct
2 Correct 12 ms 5224 KB Output is correct
3 Correct 132 ms 5224 KB Output is correct
4 Correct 79 ms 5224 KB Output is correct
5 Correct 129 ms 5224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 5224 KB Output is correct
2 Correct 21 ms 5224 KB Output is correct
3 Correct 107 ms 5224 KB Output is correct
4 Correct 85 ms 5224 KB Output is correct
5 Correct 0 ms 5224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 5224 KB Output is correct
2 Correct 29 ms 5224 KB Output is correct
3 Correct 133 ms 5224 KB Output is correct
4 Correct 92 ms 5224 KB Output is correct
5 Correct 120 ms 5224 KB Output is correct