update
This commit is contained in:
		
							parent
							
								
									569e030b48
								
							
						
					
					
						commit
						7ad3b0d80e
					
				| @ -25,7 +25,7 @@ std::string s; | |||||||
| double mtx_len[max_n][max_n]; | double mtx_len[max_n][max_n]; | ||||||
| double max_len[max_n]; | double max_len[max_n]; | ||||||
| const double double_max = std::numeric_limits<double>::max(), double_min = std::numeric_limits<double>::min(); | 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){ | double len(const Point &p1, const Point &p2){ | ||||||
|     return std::sqrt( |     return std::sqrt( | ||||||
| @ -50,7 +50,6 @@ int main(){ | |||||||
|             } |             } | ||||||
|             if(s[j-1]=='1'){ |             if(s[j-1]=='1'){ | ||||||
|                 mtx_len[i][j] = len(points[i],points[j]); |                 mtx_len[i][j] = len(points[i],points[j]); | ||||||
|                 default_ans = std::max(default_ans,mtx_len[i][j]);  |  | ||||||
|             }else{ |             }else{ | ||||||
|                 mtx_len[i][j] = double_max; |                 mtx_len[i][j] = double_max; | ||||||
|             } |             } | ||||||
| @ -78,6 +77,7 @@ int main(){ | |||||||
|         for(ull j=1;j<=n;j++){ |         for(ull j=1;j<=n;j++){ | ||||||
|             if(mtx_len[i][j]==double_max)continue; |             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])); |             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( |     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'; | ||||||
| } | } | ||||||
| @ -1,4 +1,3 @@ | |||||||
| #include <cmath> |  | ||||||
| #include <iostream> | #include <iostream> | ||||||
| 
 | 
 | ||||||
| #define NV(v)#v<<" : "<<(v) | #define NV(v)#v<<" : "<<(v) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user