#include "network.h"
#include <vector>
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;
if(total_dist-od >= 0) points[total_dist-od].push_back(i);
}
int current_point = a, current_dist = 0;
int sz;
while(true){
++current_dist;
if(current_dist == total_dist+1){
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){
current_point=tmp;
travelTo(current_point);
break;
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
128 ms |
5224 KB |
Output is correct |
2 |
Correct |
126 ms |
5224 KB |
Output is correct |
3 |
Correct |
97 ms |
5224 KB |
Output is correct |
4 |
Correct |
107 ms |
5224 KB |
Output is correct |
5 |
Correct |
34 ms |
5224 KB |
Output is correct |
6 |
Correct |
101 ms |
5224 KB |
Output is correct |
7 |
Correct |
0 ms |
5224 KB |
Output is correct |
8 |
Correct |
0 ms |
5224 KB |
Output is correct |
9 |
Correct |
0 ms |
5224 KB |
Output is correct |
10 |
Correct |
0 ms |
5224 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
101 ms |
5224 KB |
Output is correct |
2 |
Correct |
24 ms |
5224 KB |
Output is correct |
3 |
Correct |
108 ms |
5224 KB |
Output is correct |
4 |
Correct |
84 ms |
5224 KB |
Output is correct |
5 |
Correct |
134 ms |
5224 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
55 ms |
5224 KB |
Output is correct |
2 |
Correct |
17 ms |
5224 KB |
Output is correct |
3 |
Correct |
108 ms |
5224 KB |
Output is correct |
4 |
Correct |
79 ms |
5224 KB |
Output is correct |
5 |
Correct |
115 ms |
5224 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
5224 KB |
Output is correct |
2 |
Correct |
16 ms |
5224 KB |
Output is correct |
3 |
Correct |
121 ms |
5224 KB |
Output is correct |
4 |
Correct |
83 ms |
5224 KB |
Output is correct |
5 |
Correct |
71 ms |
5224 KB |
Output is correct |