# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
590980 | AlperenT | Towns (IOI15_towns) | C++17 | 14 ms | 1092 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;
const int INF = 1e9 + 5;
int hubDistance(int n, int sub){
if(sub == 3){
}
else{
int dist0[n];
for(int i = 0; i < n; i++) dist0[i] = getDistance(0, i);
int A = max_element(dist0, dist0 + n) - dist0;
int distA[n];
for(int i = 0; i < n; i++) distA[i] = getDistance(A, i);
int B = max_element(distA, distA + n) - distA;
int distB[n];
for(int i = 0; i < n; i++) distB[i] = getDistance(B, i);
map<pair<int, int>, vector<int>> mp;
for(int C = 0; C < n; C++){
int xtoc = (distA[C] + distB[C] - distA[B]) / 2;
mp[{distA[C] - xtoc, distB[C] - xtoc}].push_back(xtoc);
}
int mn = INF;
for(auto p : mp) mn = min(mn, max(p.first.first, p.first.second));
if(sub == 1 || sub == 2) return mn;
else{
}
int R = getDistance(0,1);
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... |