#define NDEBUG #include #include #include #include #include #include #define NV(v)#v<<" : "<<(v) #ifdef NDEBUG #define DEBUG(code) #else #define DEBUG(code){code} #endif using ull = unsigned long long; const size_t max_n = 150+5; struct Point{ ull x,y; }; ull n; Point points[max_n]; 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{0}; double len(const Point &p1, const Point &p2){ return std::sqrt( std::pow((double)p1.x-(double)p2.x, (double)2)+ std::pow((double)p1.y-(double)p2.y,(double)2) ); } int main(){ // std::cout<>n; for(ull i = 1;i<=n;i++){ std::cin>>points[i].x>>points[i].y; } 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{ mtx_len[i][j] = double_max; } } } for(ull k=1;k<=n;k++){ for(ull i=1;i<=n;i++){ for(ull j=1;j<=n;j++){ double new_len; if(mtx_len[i][k]!=double_max && mtx_len[k][j]!=double_max){ new_len = mtx_len[i][k]+mtx_len[k][j]; }else{ continue; } if(new_len