Submission #60165

#TimeUsernameProblemLanguageResultExecution timeMemory
60165dukati8Towns (IOI15_towns)C++14
0 / 100
26 ms488 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=0; 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=0; 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,newval; newr=max(pos[i],N-pos[i]); R=min(R,newr); } return R; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:33:12: warning: unused variable 'newval' [-Wunused-variable]
   int newr,newval;
            ^~~~~~
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...