#pragma GCC optimize("O3") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using P = pair; using T = tuple; template inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;} template inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;} constexpr int MOD = 1e9 + 7; constexpr int inf = 1e9; constexpr long long INF = 1e18; constexpr double pi = acos(-1); constexpr double EPS = 1e-10; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; struct UnionFind{ vector par; vector rank; vector sz; int uf_size; private: void init(int n = 1){ par.resize(n); rank.resize(n); sz.resize(n); uf_size = n; for(int i=0; i>n; vector x(n), y(n); for(int i=0; i>x[i]>>y[i]; ll ng = 0, ok = 2000000000; while(ok - ng > 1){ ll mid = (ng + ok) / 2; UnionFind uf(n); for(int i=0; i mid * mid) continue; uf.unite(i, j); } } if(uf.same(0, n-1)) ok = mid; else ng = mid; } if(ok % 10 != 0) ok += 10 - ok % 10; cout << ok << endl; return 0; }