Submission #592189

#TimeUsernameProblemLanguageResultExecution timeMemory
592189DeepessonTowns (IOI15_towns)C++17
13 / 100
17 ms884 KiB
#include <bits/stdc++.h> int getDistance(int i, int j); int hubDistance(int N, int sub); typedef std::pair<int,int> pii; pii MaisDistante(int N,int x){ int best=-1,alvo=0; for(int i=0;i!=N;++i){ if(i==x)continue; int d = getDistance(i,x); if(d>best){ best=d; alvo=i; } } return {best,alvo}; } int hubDistance(int N, int sub) { pii alpha = MaisDistante(N,0); pii beta = MaisDistante(N,alpha.second); int d = beta.first; int ans=1e9; for(int i=0;i!=N;++i){ if(i==alpha.second||i==beta.second)continue; int a = getDistance(i,alpha.second); int b = getDistance(i,beta.second); int soma = a+b; int subt = soma-d; int base = subt/2; ans=std::min(ans,std::max(a,b)-base); } return ans; }

Compilation message (stderr)

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