Submission #399936

#TimeUsernameProblemLanguageResultExecution timeMemory
399936biggTowns (IOI15_towns)C++14
0 / 100
20 ms452 KiB
#include "towns.h" #include<bits/stdc++.h> using namespace std; const int MAXN = 1e6; int dist[5][MAXN]; pair<int, int> p1, p2; int hubDistance(int N, int sub) { for(int i = 1; i < N; i++){ int d = getDistance(0, i); if(d > p1.second) p1 = {i,d}; } for(int i = 0; i < N; i++){ dist[0][i] = getDistance(i, p1.first); if(dist[0][i] > p2.second) p2 = { i, dist[0][i]}; } for(int i = 0; i < N; i++){ dist[1][i] = getDistance(i, p2.first); } int ans = 1e9 + 10; int diam = dist[0][p2.first]; for(int i = 0; i < N; i++) ans = min(ans, (diam + abs(dist[0][i] - dist[1][i]))/2); return ans; }

Compilation message (stderr)

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