This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "network.h"
#include <map>
using namespace std;
map<int,int> path;
map<int,int>::iterator it;
void findRoute (int n, int a, int b)
{
/*
* Obviously, this is not a good solution.
* Replace it with your own code.
*/
int dist = ping(a, b);
int x,y;
path[dist+1]=b;
int i;
for(i=1;i<=n;i++){
if(i==a || i==b) continue;
x=ping(a,i);
if(path.find(x+1)!=path.end()) continue;
path[x+1]=i;
it=path.find(x+1);
it++;
y=ping(i,it->second);
if(it->first != x+y+2){
path.erase(x+1);
}
}
for(it=path.begin(); it!=path.end(); it++){
travelTo(it->second);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |