Submission #802244

#TimeUsernameProblemLanguageResultExecution timeMemory
802244caganyanmazTowns (IOI15_towns)C++17
0 / 100
14 ms664 KiB
#include <bits/stdc++.h> #include "towns.h" using namespace std; constexpr static int INF = 2e9; constexpr static int MXSIZE = 110; int n; int jdist[MXSIZE]; 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); jdist[i] = val; 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 = jdist[i]; 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:12:28: warning: unused parameter 'sub' [-Wunused-parameter]
   12 | 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...