Submission #286332

#TimeUsernameProblemLanguageResultExecution timeMemory
286332evpipisTowns (IOI15_towns)C++11
0 / 100
37 ms1144 KiB
#include "towns.h" #include <bits/stdc++.h> using namespace std; #define mp make_pair typedef pair<int, int> ii; const int len = 115; map<ii, int> mym; int disa[len], disb[len]; int ask(int a, int b){ if (a > b) swap(a, b); if (mym.count(mp(a, b))) return mym[mp(a, b)]; return mym[mp(a, b)] = getDistance(a, b); } int hubDistance(int n, int sub) { int a = 0, b = 0; for (int i = 0; i < n; i++) if (ask(a, i) > ask(a, b)) b = i; for (int i = 0; i < n; i++) if (ask(i, b) > ask(a, b)) a = i; int R = ask(a, b); for (int c = 0; c < n; c++){ disa[c] = (ask(a, b)+ask(a, c)-ask(b, c))/2; disb[c] = ask(a, b)-disa[c]; R = min(R, max(disa[c], disb[c])); } return R; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:20:28: warning: unused parameter 'sub' [-Wunused-parameter]
   20 | 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...