# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42603 | Hassoony | Computer Network (BOI14_network) | C++14 | 162 ms | 58832 KiB |
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<bits/stdc++.h>
#define S second
#define F first
using namespace std;
#include "network.h"
int l;
vector<pair<int,int> >v;
vector<int>ans;
void findRoute(int n,int a,int b){
v.push_back({0,a});
for(int i=1;i<=n;i++){
if(i==a)continue;
v.push_back({ping(a,i),i});
}
sort(v.begin(),v.end());
while(v.back().S!=b)v.pop_back();
l=v.size()-1;
ans.push_back(b);
for(int i=v.size()-2;i>=0;i--){
int dis=ping(v[i].S,v[l].S);
if(dis+v[i].F==v[l].F-1){
l=i;
ans.push_back(v[i].S);
}
}
reverse(ans.begin(),ans.end());
for(auto pp:ans)travelTo(pp);
}
Compilation message (stderr)
# | 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... |