# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
216938 | bharat2002 | Computer Network (BOI14_network) | C++14 | 138 ms | 8568 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 "network.h"
#include<bits/stdc++.h>
using namespace std;
const int N=1e3 + 100;
int dista[N], distb[N];
bool sf(int a, int b)
{
return dista[a]<dista[b];
}
void findRoute(int n, int a, int b)
{
for(int i=1;i<=n;i++)
{
if(i==a) continue;
dista[i]=ping(i, a) +1;
}
for(int i=1;i<=n;i++)
{
if(i==b) continue;
distb[i]=ping(i, b) + 1;
}
distb[b]=0;
vector<int> vals;
for(int i=1;i<=n;i++)
{
if(dista[i] + distb[i]==dista[b]&&i!=a)
{
vals.push_back(i);
}
}
sort(vals.begin(), vals.end(), sf);
int prev=0;
for(auto i:vals)
{
assert(dista[i]==prev+1);prev++;
travelTo(i);
}
}
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... |