This commit is contained in:
Zengtudor 2024-10-09 22:10:30 +08:00
parent f9e10f2f9a
commit 5973bcf498

View File

@ -1,4 +1,5 @@
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string>
@ -36,6 +37,9 @@ int main(){
for(ull i=1;i<=n;i++){
std::cin>>s;
for(ull j=1;j<=n;j++){
if(i==j){
continue;
}
if(s[j-1]=='1'){
mtx_len[i][j] = len(points[i],points[j]);
}else{
@ -66,18 +70,18 @@ int main(){
max_len[i] = std::max(mtx_len[i][j],(max_len[i]==double_inf?double_min:max_len[i]));
}
}
std::cout<<NV(min_ans)<<"\n---start\n";
// std::cout<<NV(min_ans)<<"\n---start\n";
for(ull i=1;i<=n;i++){
for(ull j=i+1;j<=n;j++){
if(mtx_len[i][j]==double_inf){
std::cout<<NV(i)<<'\n'<<NV(j)<<'\n'<<NV(max_len[i])<<'\n'<<NV(max_len[j])<<'\n'
<<NV(len(points[i], points[j]))<<'\n'<<NV(max_len[i]+ len(points[i], points[j]) + max_len[j])<<'\n';
// std::cout<<NV(i)<<'\n'<<NV(j)<<'\n'<<NV(max_len[i])<<'\n'<<NV(max_len[j])<<'\n'
// <<NV(len(points[i], points[j]))<<'\n'<<NV(max_len[i]+ len(points[i], points[j]) + max_len[j])<<'\n';
min_ans = std::min(max_len[i]+ len(points[i], points[j]) +max_len[j],min_ans);
std::cout<<NV(min_ans)<<'\n';
std::cout<<"---\n";
// std::cout<<NV(min_ans)<<'\n';
// std::cout<<"---\n";
}
}
}
std::cout<<min_ans<<'\n';
std::cout<<std::fixed<<std::setprecision(6)<<min_ans<<'\n';
}