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 <queue>
using namespace std;
int d[1002],p[1002];
priority_queue <pair<int,int> > q;
void findRoute (int n, int a, int b)
{
int dist = ping(a,b);
int i,x,last=b;
pair<int,int> top;
d[b]=dist;
for(i=1;i<=n;i++){
if(i==a || i==b) continue;
x=ping(a,i);
if(x>=dist) continue;
q.push(make_pair(x,i));
d[i]=x;
}
q.push(make_pair(-1,a));
while(!q.empty()){
top=q.top();
q.pop();
if(d[last] == top.first) continue;
if(ping(top.second,last)==0){
p[d[last]]=last;
last=top.second;
}
}
for(i=0;i<=dist;i++){
travelTo(p[i]);
}
}
# | 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... |