結果

問題 No.168 ものさし
ユーザー 沙耶花
提出日時 2021-11-03 12:37:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 633 bytes
コンパイル時間 5,037 ms
コンパイル使用メモリ 252,196 KB
最終ジャッジ日時 2025-01-25 10:53:20
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 2000000000



int main(){	
	
	int N;
	cin>>N;
	
	vector<long long> x(N),y(N);
	rep(i,N)cin>>x[i]>>y[i];
	
	long long ng = 0LL,ok = Inf/10;
	while(ok-ng>1LL){
		long long mid = (ok+ng)/2;
		dsu D(N);
		rep(i,N){
			for(int j=i+1;j<N;j++){
				long long dx = x[i]-x[j],dy = y[i]-y[j];
				if(dx*dx+dy*dy <= (mid*10)*(mid*10))D.merge(i,j);
			}
		}
		if(D.same(0,N-1))ok = mid;
		else ng = mid;
	}
	cout<<ok*10<<endl;
	
	return 0;
	
}
0