Submission #640242

#TimeUsernameProblemLanguageResultExecution timeMemory
640242ggohTowns (IOI15_towns)C++14
13 / 100
13 ms496 KiB
#include "towns.h" #include<bits/stdc++.h> using namespace std; #define sz(v) ((int)(v).size()) typedef long long lint; int hubDistance(int N, int sub) { int dis,maxi=-1,maxj=-1,maxx=-1; int R=1e9; for(int i=1;i<N;i++) { dis=getDistance(0,i); if(dis>maxx) { maxx=dis; maxi=i; } } maxx=-1; for(int i=0;i<N;i++) { if(i!=maxi) { dis=getDistance(maxi,i); if(dis>maxx) { maxx=dis; maxj=i; } } } vector<int>X; for(int i=0;i<N;i++) { if(i!=maxi && i!=maxj) { X.push_back((getDistance(maxi,i)-getDistance(maxj,i)+maxx)/2); } } sort(X.begin(),X.end()); for(auto &k:X) { R=min(R,max(maxx-k,k)); } return R; }

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...