Submission #410977

#TimeUsernameProblemLanguageResultExecution timeMemory
410977ja_kingyTowns (IOI15_towns)C++14
25 / 100
19 ms964 KiB
#include "towns.h" #include <bits/stdc++.h> using namespace std; int hubDistance(int n, int sub) { vector<int> d0(n), d1(n); int mx = 0, R = 1e9; for (int i = 1; i < n; ++i) { d0[i] = getDistance(0, i); if (d0[i] > d0[mx]) mx = i; } d1[0] = d0[mx]; int d = d0[mx]; map<int, vector<int>> groups; for (int i = 1; i < n; ++i) if (i != mx) { d1[i] = getDistance(mx, i); groups[(d1[i] - d0[i] + d0[mx]) / 2].push_back(i); d = max(d, d1[i]); } //cerr << mx << ' ' << d << ' ' << endl; int hub = 0; for (auto g: groups) { R = min(R, max(g.first, d-g.first)); //cerr << g.first << ' ' << g.second.size() << endl; } //cerr << R << endl; return R; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:21:6: warning: unused variable 'hub' [-Wunused-variable]
   21 |  int hub = 0;
      |      ^~~
towns.cpp:5:28: warning: unused parameter 'sub' [-Wunused-parameter]
    5 | 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...