Submission #16052

#TimeUsernameProblemLanguageResultExecution timeMemory
16052kriiiComputer Network (BOI14_network)C++14
100 / 100
153 ms5216 KiB
#include "network.h" #include <vector> using namespace std; vector<int> p[1001]; void findRoute (int N, int a, int b) { int dist = ping(a,b); for (int i=1;i<=N;i++) if (i != a){ p[ping(a,i)+1].push_back(i); } for (int d=1;d<=dist;d++){ bool ed = 0; for (int i=1;i<p[d].size();i++){ if (ping(a,p[d][i]) == 0){ if (d + ping(p[d][i],b) == dist){ travelTo(a=p[d][i]); ed = 1; break; } } } if (!ed) travelTo(a=p[d][0]); } travelTo(b); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...