Submission #17636

#TimeUsernameProblemLanguageResultExecution timeMemory
17636NamnamseoComputer Network (BOI14_network)C++14
100 / 100
134 ms5224 KiB
#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; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...