Submission #496604

#TimeUsernameProblemLanguageResultExecution timeMemory
496604mosiashvililukaTowns (IOI15_towns)C++14
0 / 100
16 ms1068 KiB
#include<bits/stdc++.h> #include "towns.h" using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,fx[104][104],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;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...