Submission #60168

#TimeUsernameProblemLanguageResultExecution timeMemory
60168dukati8Towns (IOI15_towns)C++14
25 / 100
38 ms2984 KiB
#include "towns.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for (int i =a; i<int(b); i++) int hubDistance(int N, int sub) { int high=-1; int highind=-1; rep(i,1,N) { int dist=getDistance(0,i); if (dist>high) {high=dist; highind=i;} } int A=highind; int Adists[N]; high=-1; highind=-1; rep (i,0,N) { Adists[i]=getDistance(A,i); if (Adists[i]>high) {high=Adists[i]; highind=i;} } int B=highind; int diameter=high; int Bdists[N]; rep (i,0,N) { Bdists[i]=getDistance(B,i); } int pos[N]; rep (i,0,N) { int extra=(Adists[i]+Bdists[i]-diameter)/2; pos[i]=Adists[i]-extra; } int R=diameter; rep (i,0,N) { int newr; newr=max(pos[i],diameter-pos[i]); R=min(R,newr); } return R; }

Compilation message (stderr)

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