Submission #233267

#TimeUsernameProblemLanguageResultExecution timeMemory
233267mieszko11bTowns (IOI15_towns)C++14
25 / 100
27 ms1152 KiB
#include "towns.h" #include <bits/stdc++.h> using namespace std; int v = 0, s, t; int distv[120], dists[120]; int hubDistance(int N, int sub) { int maxv = 0; for(int i = 0 ; i < N ; i++) { distv[i] = getDistance(v, i); maxv = max(maxv, distv[i]); } for(int i = 0 ; i < N ; i++) if(distv[i] == maxv) s = i; int dsv = maxv; maxv = 0; for(int i = 0 ; i < N ; i++) { dists[i] = getDistance(s, i); maxv = max(maxv, dists[i]); } int d = maxv; for(int i = 0 ; i < N ; i++) if(dists[i] == maxv) t = i; int res = 1e9; for(int i = 0 ; i < N ; i++) { int a = (dists[i] + dsv - distv[i]) / 2; int b = dsv - a; res = min(res, max({a, b, d - a})); //~ cout << i << " " << res << endl; } return res; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:9:28: warning: unused parameter 'sub' [-Wunused-parameter]
 int hubDistance(int N, int sub) {
                            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...