Submission #497111

#TimeUsernameProblemLanguageResultExecution timeMemory
497111mosiashvililukaTowns (IOI15_towns)C++14
0 / 100
16 ms1072 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 dis(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=dis(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=dis(A,i); if(zx<c){ zx=c;xc=i; } } B=xc; pas=dis(A,B); for(i=1; i<=a; i++){ if(i==A||i==B) continue; zx=(dis(i,A)+dis(1,A)-dis(1,i))/2;xc=dis(B,A)-zx; 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...