# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133665 | Mahdi_Jfri | Towns (IOI15_towns) | C++14 | 21 ms | 476 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 ll long long
#define pb push_back
const int maxn = 1e2 + 20;
int h[2][maxn];
int hubDistance(int n, int sub)
{
memset(h , 0 , sizeof h);
for(int i = 1; i < n; i++)
h[0][i] = getDistance(0 , i);
int a = max_element(h[0] , h[0] + n) - h[0];
memset(h[0] , 0 , sizeof h[0]);
for(int i = 0; i < n; i++)
if(i != a)
h[0][i] = getDistance(a , i);
int b = max_element(h[0] , h[0] + n) - h[0];
for(int i = 0; i < n; i++)
if(i != b)
h[1][i] = getDistance(b , i);
vector<int> val;
int ans = 1e9;
for(int i = 0; i < n; i++)
{
int k = h[0][i] - h[1][i] + h[0][b];
while(k % 2);
k /= 2;
ans = min(ans , max(k , h[0][b] - k));
}
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... |