# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151459 | Bodo171 | Towns (IOI15_towns) | C++14 | 21 ms | 444 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 "towns.h"
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int nmax=205;
int n;
int d[2][nmax];
int to[nmax],wh[nmax],sz[nmax];
int hubDistance(int N, int sub) {
int d1=0,R=0,mx=0,d2=0;
n=N;
for(int i=1; i<n; i++)
{
d[0][i]=getDistance(0,i);
if(d[0][i]>d[0][d1])
d1=i;
}
for(int i=0; i<n; i++)
if(i!=d1)
{
d[1][i]=getDistance(d1,i);
if(d[1][i]>mx)
mx=d[1][i],d2=i;
}
int minDist=(1<<30);
int lim=d[1][d2]-(d[0][d2]+d[1][d2]-d[0][d1])/2;
for(int i=0; i<n; i++)
{
to[i]=(d[0][i]+d[1][i]-d[0][d1])/2;
wh[i]=(d[1][i]-to[i]);
if(max(wh[i],mx-wh[i])<minDist&&wh[i]<=lim)
minDist=max(wh[i],mx-wh[i]);
}
R=minDist;
return R;
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |