Submission #1098323

#TimeUsernameProblemLanguageResultExecution timeMemory
1098323alexander707070Towns (IOI15_towns)C++14
25 / 100
12 ms1008 KiB
#include<bits/stdc++.h> #include "towns.h" #define MAXN 200 using namespace std; int n,r; int dist[MAXN],s,t,diameter,dist2[MAXN]; int hubDistance(int N, int sub) { int n=N; s=0; dist[0]=0; for(int i=1;i<n;i++){ dist[i]=getDistance(0,i); if(dist[i]>dist[s])s=i; } dist[s]=0; t=s; for(int i=0;i<n;i++){ if(i==s)continue; dist[i]=getDistance(s,i); if(dist[i]>dist[t])t=i; } diameter=dist[t]; r=1000000; for(int i=0;i<n;i++){ if(i==s or i==t)continue; dist2[i]=getDistance(t,i); int sum=(diameter+dist[i]+dist2[i])/2; r=min(r,max(sum-dist[i],sum-dist2[i])); } return r; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:12:6: warning: declaration of 'n' shadows a global declaration [-Wshadow]
   12 |  int n=N;
      |      ^
towns.cpp:8:5: note: shadowed declaration is here
    8 | int n,r;
      |     ^
towns.cpp:11:28: warning: unused parameter 'sub' [-Wunused-parameter]
   11 | 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...