#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;
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;
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
141 ms |
5224 KB |
Output is correct |
2 |
Runtime error |
102 ms |
5220 KB |
Program hung waiting for input |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
107 ms |
5224 KB |
Output is correct |
2 |
Correct |
27 ms |
5224 KB |
Output is correct |
3 |
Correct |
0 ms |
5224 KB |
Output is correct |
4 |
Correct |
58 ms |
5224 KB |
Output is correct |
5 |
Correct |
0 ms |
5224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
112 ms |
5224 KB |
Output is correct |
2 |
Correct |
29 ms |
5224 KB |
Output is correct |
3 |
Correct |
116 ms |
5224 KB |
Output is correct |
4 |
Correct |
99 ms |
5224 KB |
Output is correct |
5 |
Correct |
120 ms |
5224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
119 ms |
5224 KB |
Output is correct |
2 |
Correct |
23 ms |
5224 KB |
Output is correct |
3 |
Correct |
112 ms |
5224 KB |
Output is correct |
4 |
Correct |
83 ms |
5224 KB |
Output is correct |
5 |
Correct |
118 ms |
5224 KB |
Output is correct |