This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// This Program is made by Jan(Codezebra)
#include<bits/stdc++.h>
#include "towns.h"
using namespace std;
int table[111][111];
int get(int i,int j){
if(table[i][j]==-1){
table[i][j]=getDistance(i,j);
table[j][i]=table[i][j];
}
return table[i][j];
}
int hubDistance(int n,int sub){
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
table[i][j]=-1;
}
}
if(sub<3){
int mx=0,my=0,ma=0;
for(int i=0;i<n;i++){
int d=get(i,0);
if(d>ma){
ma=d;
mx=i;
}
}
ma=0;
for(int i=0;i<n;i++){
int d=get(i,mx);
if(d>ma){
ma=d;
my=i;
}
}
cout<<mx<<" "<<my<<"\n";
int ans=1e7;
for(int i=0;i<n;i++){
int a=get(i,mx),b=get(my,mx),c=get(i,my);
ans=min(ans,max(a+b-c,max(a-b+c,-a+b+c)));
cout<<ans<<"\n";
}
return ans/2;
}
}
Compilation message (stderr)
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |