# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080018 | Trumling | Towns (IOI15_towns) | C++14 | 9 ms | 1112 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<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(),x.end()
#define INF 9999999999999
typedef long long ll;
int hubDistance(int N, int sub) {
ll n=N;
vector<vector<ll>>g(N,vector<ll>(N));
ll maxi=-1;
pair<ll,ll>curr;
for(int i=0;i<n;i++)
for(int j=i+1;j<n;j++)
{
ll R=getDistance(i,j);
g[i][j]=R;
g[j][i]=R;
if(maxi<R)
{
maxi=g[i][j];
curr={i,j};
}
}
ll ans=INF;
for(int i=0;i<n;i++)
if(i!=curr.F && i!=curr.S)
{
ll f=(g[i][curr.F] + g[i][curr.S] - maxi)/2;
ans=min(ans,min(g[i][curr.F]-f,g[i][curr.S]-f));
}
return ans;
}
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... |