Submission #410976

#TimeUsernameProblemLanguageResultExecution timeMemory
410976ja_kingyTowns (IOI15_towns)C++14
0 / 100
25 ms972 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 = 0; for (int i = 1; i < n; ++i) if (i != mx) { d1[i] = getDistance(mx, i); d = max(d, d1[i]); } map<int, vector<int>> groups; for (int i = 1; i < n; ++i) { if (i != mx) groups[(d1[i] - d0[i] + d0[mx]) / 2].push_back(i); } 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:22:6: warning: unused variable 'hub' [-Wunused-variable]
   22 |  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...