結果

問題 No.94 圏外です。(EASY)
ユーザー roiti46roiti46
提出日時 2014-12-07 21:43:51
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 953 bytes
コンパイル時間 563 ms
コンパイル使用メモリ 64,796 KB
実行使用メモリ 7,488 KB
最終ジャッジ日時 2023-09-02 10:52:44
合計ジャッジ時間 11,712 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 13 ms
4,380 KB
testcase_06 AC 41 ms
4,864 KB
testcase_07 AC 129 ms
5,576 KB
testcase_08 AC 354 ms
6,300 KB
testcase_09 AC 874 ms
7,356 KB
testcase_10 AC 878 ms
7,448 KB
testcase_11 AC 870 ms
7,384 KB
testcase_12 AC 867 ms
7,440 KB
testcase_13 AC 886 ms
7,384 KB
testcase_14 AC 874 ms
7,488 KB
testcase_15 AC 870 ms
7,488 KB
testcase_16 AC 871 ms
7,444 KB
testcase_17 AC 851 ms
7,388 KB
testcase_18 AC 865 ms
7,440 KB
testcase_19 AC 868 ms
7,356 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 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 = 0.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