Submission #16045

#TimeUsernameProblemLanguageResultExecution timeMemory
16045kaTkaHrComputer Network (BOI14_network)C++98
100 / 100
166 ms5220 KiB
#include "network.h" #include<vector> using namespace std; const int MX = 1005; vector<int> G[MX]; void findRoute (int N, int a, int b) { int D = ping(a, b) + 1; for (int i = 1; i <= N; i++){ if (i == b) G[0].push_back(b); else if( i != a ) G[ping(b, i) + 1].push_back(i); else G[D].push_back(i); } int nw = a; for (int i = 1;; i++){ int nxt = -1; for (int j = 0; j < G[D - i].size(); j++){ int c = G[D - i][j]; if (ping(nw, c) == 0){ nxt = c; if (nxt == b){ travelTo(nxt); return; } } } nw = nxt; travelTo(nxt); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...