結果
| 問題 |
No.94 圏外です。(EASY)
|
| コンテスト | |
| ユーザー |
tea_pt
|
| 提出日時 | 2015-06-12 21:19:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,287 bytes |
| コンパイル時間 | 806 ms |
| コンパイル使用メモリ | 93,060 KB |
| 実行使用メモリ | 11,540 KB |
| 最終ジャッジ日時 | 2024-07-06 15:53:32 |
| 合計ジャッジ時間 | 1,600 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 2 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <stack>
#include <array>
#include <fstream>
#include <complex>
#define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
#define REPS(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
#if defined(_MSC_VER)||__cplusplus > 199711L
#define AUTO(r,v) auto r = (v)
#else
#define AUTO(r,v) typeof(v) r = (v)
#endif
#define ALL(c) (c).begin() , (c).end()
#define EACH(it,c) for(AUTO(it,(c).begin());it != (c).end();++it)
#define LL long long
#define int LL
#define INF 999999999999
#define DEV 1000000007
#define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
using namespace std;
class UnionFind{
public:
//nは要素数
UnionFind(int n) :
par(n),
rank(n)
{
for (int i = 0; i < n; ++i){
par[i] = i;
}
}
//xとyの属する集合を結合
void unite(int x, int y){
x = find(x);
y = find(y);
if (x == y)return;
if (rank.at(x) < rank.at(y)){
par.at(x) = y;
}
else{
par.at(y) = x;
if (rank.at(x) == rank.at(y))rank.at(x)++;
}
}
bool same(int x, int y){
return find(x) == find(y);
}
private:
//親
vector<int> par;
//根の深さ
vector<int> rank;
//木の根を求める
int find(int x){
if (par.at(x) == x){
return x;
}
else{
return par.at(x) = find(par.at(x));
}
}
};
int d[1002][1002];
complex<int> p[1002];
int n;
bool solve(int mu){
UnionFind uf(n);
REP(i, n){
REP(j, n){
if (d[i][j] <= mu ){
uf.unite(i, j);
}
}
}
return uf.same(0, n - 1);
}
signed main()
{
QUICK_CIN;
//ifstream cin("debug.txt");
//ofstream cout("result.txt");
cin >> n;
REP(i, n){
int x, y;
cin >> x >> y;
p[i] = { (int)x, (int)y };
}
REP(i, n){
REP(j, n){
d[i][j] = norm(p[i] - p[j]);
}
}
UnionFind uf(n+1);
REP(i, n){
REP(j, n){
if (d[i][j] <= 100){
uf.unite(i, j);
}
}
}
int mi = 1;
REP(i, n){
REP(j, n){
if (uf.same(i, j)){
mi = max(d[i][j], mi);
}
}
}
printf("%.10lf\n", sqrt(mi) + 2*!!n);
return 0;
}
tea_pt