# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
434020 | benedict0724 | Towns (IOI15_towns) | C++17 | 17 ms | 344 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;
int S = 0, E;
const int INF = 1e9;
int dist[110], dist2[110], distD[110], Hub[110], tmp[110], x[110], y[110];
vector<int> v;
int getSame(int x, int y)
{
}
int hubDistance(int N, int sub) {
for(int i=0;i<N;i++) dist[i] = dist2[i] = Hub[i] = x[i] = y[i] = 0;
for(int i=1;i<N;i++) dist[i] = getDistance(S, i);
E = 1;
for(int i=1;i<N;i++) if(dist[E] < dist[i]) E = i;
for(int i=0;i<N;i++)
{
if(i == E) continue;
dist2[i] = getDistance(i, E);
}
int Rad = dist[E];
int opt = INF;
for(int i=1;i<N;i++)
{
if(i == E) continue;
distD[i] = (dist[i] + dist2[i] - Rad)/2;
x[i] = (dist[i] + Rad - dist2[i])/2;
y[i] = (-dist[i] + Rad + dist2[i])/2;
}
for(int i=1;i<N;i++)
{
if(i == E) continue;
int M = max(x[i], Rad - x[i]);
for(int j=1;j<N;j++)
{
if(j == E) continue;
tmp[j] = distD[j] + abs(x[i] - x[j]);
M = max(M, tmp[j]);
}
if(M < opt)
{
opt = M;
Hub[S] = x[i];
Hub[E] = Rad - x[i];
for(int j=1;j<N;j++)
{
if(j == E) continue;
Hub[j] = tmp[j];
}
}
}
int R = max(Hub[S], Hub[E]);
/*
stack<int> st;
st.push(0);
for(int i=0;i<N;i++)
{
}
*/
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... |