This commit is contained in:
Zengtudor 2024-10-10 19:58:30 +08:00
parent 569e030b48
commit 7ad3b0d80e
2 changed files with 3 additions and 4 deletions

View File

@ -25,7 +25,7 @@ std::string s;
double mtx_len[max_n][max_n];
double max_len[max_n];
const double double_max = std::numeric_limits<double>::max(), double_min = std::numeric_limits<double>::min();
double min_ans {double_max}, default_ans{double_min};
double min_ans {double_max}, default_ans{0};
double len(const Point &p1, const Point &p2){
return std::sqrt(
@ -50,7 +50,6 @@ int main(){
}
if(s[j-1]=='1'){
mtx_len[i][j] = len(points[i],points[j]);
default_ans = std::max(default_ans,mtx_len[i][j]);
}else{
mtx_len[i][j] = double_max;
}
@ -78,6 +77,7 @@ int main(){
for(ull j=1;j<=n;j++){
if(mtx_len[i][j]==double_max)continue;
max_len[i] = std::max(mtx_len[i][j],(max_len[i]==double_max?double_min:max_len[i]));
default_ans = std::max(default_ans,max_len[i]);
}
}
DEBUG(
@ -99,5 +99,5 @@ int main(){
}
}
std::cout<<std::fixed<<std::setprecision(6)<<std::max(min_ans, default_ans)<<'\n';
std::cout<<std::fixed<<std::setprecision(6)<<(min_ans==double_max?default_ans:std::max(default_ans, min_ans))<<'\n';
}

View File

@ -1,4 +1,3 @@
#include <cmath>
#include <iostream>
#define NV(v)#v<<" : "<<(v)