Submission #802187

#TimeUsernameProblemLanguageResultExecution timeMemory
802187caganyanmazTowns (IOI15_towns)C++17
13 / 100
18 ms736 KiB
#include <bits/stdc++.h> #include "towns.h" using namespace std; constexpr static int INF = 2e9; constexpr static int MXSIZE = 110; int n; int hubDistance(int N, int sub) { n = N; int mxdist = 0; int j = 0; for (int i = 1; i < n; i++) { int val = getDistance(0, i); if (val > mxdist) { j = i; mxdist = val; } } int k = 0; for (int i = 1; i < n; i++) { if (i == j) continue; int val = getDistance(i, j); if (val > mxdist) { k = i; mxdist = val; } } int r = mxdist; for (int i = 0; i < n; i++) { if (i == j || i == k) continue; int da = getDistance(i, j); int db = getDistance(i, k); int change = (da + db - mxdist) / 2; r = min(r, max(da - change, db - change)); } return r; }

Compilation message (stderr)

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