結果
| 問題 |
No.94 圏外です。(EASY)
|
| コンテスト | |
| ユーザー |
ふーらくたる
|
| 提出日時 | 2016-09-23 02:23:42 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 862 ms / 5,000 ms |
| コード長 | 1,140 bytes |
| コンパイル時間 | 561 ms |
| コンパイル使用メモリ | 68,188 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 08:04:32 |
| 合計ジャッジ時間 | 10,533 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
const int MAX_N = 1010;
int x[MAX_N], y[MAX_N];
bool connected[MAX_N][MAX_N];
int square_dist(int x1, int y1, int x2, int y2) {
return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i] >> y[i];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
int d = square_dist(x[i], y[i], x[j], y[j]);
if (d <= 10 * 10) connected[i][j] = true;
}
}
for (int k = 0; k < n; k++) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
connected[i][j] |= connected[i][k] && connected[k][j];
}
}
}
double ans = 1.0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (connected[i][j]) {
double dist = sqrt(square_dist(x[i], y[i], x[j], y[j]));
ans = max(ans, dist + 2.0);
}
}
}
cout << fixed << setprecision(10) << ans << endl;
return 0;
}
ふーらくたる