Submission #1088386

#TimeUsernameProblemLanguageResultExecution timeMemory
1088386PacybwoahTowns (IOI15_towns)C++17
25 / 100
11 ms960 KiB
#include "towns.h" #include<vector> #include<algorithm> #include<utility> using namespace std; int hubDistance(int N, int sub) { int a = -1, b = -1; int maxi = 0, n = N; for(int i = 1; i < n; i++){ int len = getDistance(0, i); if(len > maxi){ maxi = len; a = i; } } vector<int> dista(n), distb(n); maxi = 0; for(int i = 0; i < n; i++){ dista[i] = getDistance(a, i); if(dista[i] > maxi){ maxi = dista[i]; b = i; } } for(int i = 0; i < n; i++){ distb[i] = getDistance(b, i); } int d = dista[b]; int ans = 1e9; for(int i = 0; i < n; i++){ int da = (d + dista[i] + distb[i]) / 2 - distb[i], db = (d + dista[i] + distb[i]) / 2 - dista[i]; ans = min(ans, max(da, db)); } return ans; } // g++ -std=c++17 -Wall -Wextra -fsanitize=undefined -fsanitize=address -Wshadow -o run towns.cpp grader.cpp

Compilation message (stderr)

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