Submission #496606

#TimeUsernameProblemLanguageResultExecution timeMemory
496606mosiashvililukaTowns (IOI15_towns)C++14
25 / 100
20 ms912 KiB
#include<bits/stdc++.h> #include "towns.h" using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,fx[124][124],A,B,pas; int getdis(int q, int w){ if(q==w) return 0; if(fx[q][w]==0){ fx[q][w]=fx[w][q]=getDistance(q-1,w-1); } return fx[q][w]; } int hubDistance(int NN, int sub) { a=NN; for(i=0; i<=a+1; i++){ for(j=0; j<=a+1; j++){ fx[i][j]=0; } } zx=0;xc=i; for(i=1; i<=a; i++){ if(i==1) continue; c=getdis(1,i); if(zx<c){ zx=c;xc=i; } } A=xc;zx=0;xc=A; for(i=1; i<=a; i++){ if(i==A) continue; c=getdis(A,i); if(zx<c){ zx=c;xc=i; } } B=xc; for(i=1; i<=a; i++){ if(B==i) continue; getdis(B,i); } pas=fx[A][B]; for(i=1; i<=a; i++){ if(i==A||i==B) continue; c=fx[A][i];d=fx[i][B];e=fx[A][B]; e=(c+d-e)/2;zx=c-e;xc=d-e; pas=min(pas,max(zx,xc)); } return pas; }

Compilation message (stderr)

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