# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
387321 | alireza_kaviani | Towns (IOI15_towns) | C++11 | 23 ms | 1132 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 <bits/stdc++.h>
#include "towns.h"
using namespace std;
#define sep ' '
const int MAXN = 1e3 + 10;
const int MOD = 1e9 + 7;
int dist[3][MAXN];
int ask(int ind , int v , int n){
int mx = 0;
for(int i = 0 ; i < n ; i++){
dist[ind][i] = getDistance(v , i);
if(dist[ind][i] > dist[ind][mx]) mx = i;
}
return mx;
}
int hubDistance(int N, int sub) {
int v = ask(0 , 0 , N);
int u = ask(1 , v , N);
ask(2 , u , N);
int mn = MOD;
for(int i = 0 ; i < N ; i++){
mn = min(mn , abs(dist[1][i] - dist[2][i]));
// cout << i << sep << dist[1][i] << sep << dist[2][i] << endl;
}
// cout << v << sep << u << endl;
int R = (dist[1][u] + mn) / 2;
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... |