結果

問題 No.94 圏外です。(EASY)
ユーザー roiti46roiti46
提出日時 2014-12-07 21:47:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 921 ms / 5,000 ms
コード長 951 bytes
コンパイル時間 546 ms
コンパイル使用メモリ 64,912 KB
実行使用メモリ 7,600 KB
最終ジャッジ日時 2023-09-08 14:17:17
合計ジャッジ時間 12,014 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 12 ms
4,472 KB
testcase_06 AC 41 ms
4,904 KB
testcase_07 AC 133 ms
5,440 KB
testcase_08 AC 363 ms
6,512 KB
testcase_09 AC 910 ms
7,540 KB
testcase_10 AC 913 ms
7,392 KB
testcase_11 AC 914 ms
7,380 KB
testcase_12 AC 912 ms
7,476 KB
testcase_13 AC 917 ms
7,600 KB
testcase_14 AC 914 ms
7,380 KB
testcase_15 AC 912 ms
7,368 KB
testcase_16 AC 913 ms
7,476 KB
testcase_17 AC 912 ms
7,600 KB
testcase_18 AC 913 ms
7,388 KB
testcase_19 AC 921 ms
7,508 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <math.h>
#define FOR(i,a,b) for(int i=(a); i<b; i++)
#define REP(i,a) FOR(i,0,a)
#define inf (1<<16)
using namespace std;

int G[1000][1000];
int N;

void warshall(){
    REP(k,N)
        REP(i,N)
            REP(j,N)
                G[i][j] = min(G[i][j],G[i][k]+G[k][j]);
}

int S(int ax, int ay, int bx, int by){
    return (bx-ax)*(bx-ax)+(by-ay)*(by-ay);
}

int main(void){
    cin >> N;
    int X[N],Y[N];
    REP(i,N) cin >> X[i] >> Y[i];
    REP(i,N){
        REP(j,N){
            if (S(X[i],Y[i],X[j],Y[j]) <= 100 ){
                G[i][j] = G[j][i] = 1;
            }else{
                G[i][j] = G[j][i] = inf;
            }
        }
    }
    warshall();
    double ans = 1.0;
    REP(i,N)
        REP(j,N)
            if (G[i][j] < inf)
                ans = max(ans,sqrt(S(X[i],Y[i],X[j],Y[j]))+2);
    printf("%.10f",ans);
    return 0;
}
0