結果
問題 | No.94 圏外です。(EASY) |
ユーザー | shimomire |
提出日時 | 2014-12-07 20:05:54 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 35 ms / 5,000 ms |
コード長 | 2,179 bytes |
コンパイル時間 | 2,700 ms |
コンパイル使用メモリ | 115,044 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-08 14:14:04 |
合計ジャッジ時間 | 2,331 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 3 ms
4,376 KB |
testcase_06 | AC | 5 ms
4,376 KB |
testcase_07 | AC | 10 ms
4,380 KB |
testcase_08 | AC | 18 ms
4,376 KB |
testcase_09 | AC | 33 ms
4,376 KB |
testcase_10 | AC | 34 ms
4,376 KB |
testcase_11 | AC | 32 ms
4,376 KB |
testcase_12 | AC | 33 ms
4,376 KB |
testcase_13 | AC | 33 ms
4,376 KB |
testcase_14 | AC | 34 ms
4,376 KB |
testcase_15 | AC | 34 ms
4,380 KB |
testcase_16 | AC | 35 ms
4,376 KB |
testcase_17 | AC | 33 ms
4,376 KB |
testcase_18 | AC | 34 ms
4,380 KB |
testcase_19 | AC | 28 ms
4,376 KB |
testcase_20 | AC | 2 ms
4,380 KB |
testcase_21 | AC | 2 ms
4,376 KB |
ソースコード
#include <cassert>// c #include <ctime> #include <iostream>// io #include <iomanip> #include <fstream> #include <sstream> #include <vector>// container #include <map> #include <set> #include <queue> #include <bitset> #include <stack> #include <algorithm>// other #include <utility> #include <complex> #include <numeric> #include <functional> #include <random> #include <regex> using namespace std; typedef long long ll; #define ALL(c) (c).begin(),(c).end() #define FOR(i,l,r) for(int i=(int)l;i<(int)r;++i) #define REP(i,n) FOR(i,0,n) #define FORr(i,l,r) for(int i=(int)r-1;i>=(int)l;--i) #define REPr(i,n) FORr(i,0,n) #define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define IN(l,v,r) ((l)<=(v) && (v)<(r)) #define UNIQUE(v) v.erase(unique(ALL(v)),v.end()) //debug #define DUMP(x) cerr << #x << " = " << (x) #define LINE() cerr<< " (L" << __LINE__ << ")" template<typename T,typename U> T pmod(T x,U M){return (x%M+M)%M;} struct UnionFind{ vector<int> par,rank,ss;int size; UnionFind(int n){ REP(i,n) par.push_back(i); rank = vector<int>(n);ss=vector<int>(n,1);size=n; } int root(int x){ if(par[x] == x)return x; return par[x] = root(par[x]); } bool same(int x,int y){ return root(x) == root(y); } void unite(int x,int y){ x = root(x);y = root(y); if(x==y)return; if(rank[x] < rank[y]){ par[x] = y;ss[y]+=ss[x]; }else{ par[y] = x;ss[x]+=ss[y]; } if(rank[x] == rank[y]) rank[x]++; size--; } int getS(int x){ return ss[root(x)]; } }; double EPS=1e-10; int main(){ cin.tie(0); ios::sync_with_stdio(false); cout <<fixed <<setprecision(20); int N;cin >> N; vector<double> xs(N),ys(N); REP(i,N){ cin >> xs[i] >> ys[i]; } UnionFind uf(N); REP(i,N)REP(j,N)if(hypot(xs[i]-xs[j],ys[i]-ys[j])<=10.0+EPS){ uf.unite(i, j); } double Mv=1; if(N>0)Mv=2; REP(i,N)REP(j,N)if(uf.same(i,j)){ Mv=max(Mv,hypot(xs[i]-xs[j],ys[i]-ys[j])+2); } cout << Mv <<endl; return 0; }