結果

問題 No.94 圏外です。(EASY)
ユーザー natsugirnatsugir
提出日時 2014-12-07 19:47:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,061 ms / 5,000 ms
コード長 1,110 bytes
コンパイル時間 965 ms
コンパイル使用メモリ 66,324 KB
実行使用メモリ 4,776 KB
最終ジャッジ日時 2023-09-08 14:14:51
合計ジャッジ時間 12,880 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 5 ms
4,376 KB
testcase_05 AC 12 ms
4,376 KB
testcase_06 AC 40 ms
4,380 KB
testcase_07 AC 123 ms
4,380 KB
testcase_08 AC 349 ms
4,384 KB
testcase_09 AC 993 ms
4,664 KB
testcase_10 AC 982 ms
4,556 KB
testcase_11 AC 940 ms
4,556 KB
testcase_12 AC 975 ms
4,668 KB
testcase_13 AC 980 ms
4,628 KB
testcase_14 AC 1,035 ms
4,608 KB
testcase_15 AC 992 ms
4,632 KB
testcase_16 AC 1,046 ms
4,664 KB
testcase_17 AC 1,061 ms
4,540 KB
testcase_18 AC 1,007 ms
4,776 KB
testcase_19 AC 840 ms
4,728 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

template<class T> inline T &amin(T &a, T b) { if (a>b) a=b; return a; }
template<class T> inline T &amax(T &a, T b) { if (a<b) a=b; return a; }

int N, X[1111], Y[1111];
bool FW[1111][1111];

int sq(int x) { return x*x; }
int sqsum(int i, int j) {
    return sq(X[i] - X[j]) + sq(Y[i] - Y[j]);
}
double hypot(int i, int j) { return sqrt(sqsum(i, j)); }
int main() {
    scanf("%d", &N);
    REP (i, N) scanf("%d%d", X+i, Y+i);

    REP (i, N) REP (j, N) if (sqsum(i, j) <= 100) FW[i][j] = true;
    REP (k, N) REP (i, N) REP (j, N) FW[i][j] = FW[i][j] || (FW[i][k] && FW[k][j]);

    double ans = 1;
    REP (i, N) {
	REP (j, N) {
	    if (FW[i][j]) {
		amax(ans, hypot(i, j) + 2.0);
	    }
	}
    }

    printf("%.9f\n", ans);
    
    return 0;
}
0