diff --git a/src/P1522/P1522.cpp b/src/P1522/P1522.cpp index 00d7868..5d40298 100644 --- a/src/P1522/P1522.cpp +++ b/src/P1522/P1522.cpp @@ -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::max(), double_min = std::numeric_limits::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< #include #define NV(v)#v<<" : "<<(v)