結果
| 問題 |
No.96 圏外です。
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-05-03 16:27:21 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,366 bytes |
| コンパイル時間 | 2,932 ms |
| コンパイル使用メモリ | 269,988 KB |
| 実行使用メモリ | 24,604 KB |
| 最終ジャッジ日時 | 2024-11-24 18:54:05 |
| 合計ジャッジ時間 | 6,768 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 23 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/dsu>
using namespace std;
using namespace atcoder;
int main() {
int N;
cin >> N;
map<pair<int,int>, vector<tuple<int,int,int>>> XY;
vector<int> X, Y;
for (int n = 0; n < N; ++n) {
int x, y;
cin >> x >> y;
XY[{x / 10, y / 10}].push_back({x, y, n});
X.push_back(x);
Y.push_back(y);
}
dsu UF(N);
for (auto& [ij, lst] : XY) {
int i=ij.first;
int j=ij.second;
for (int di = -1; di <= 1; ++di) {
for (int dj = -1; dj <= 1; ++dj) {
if (!XY.count({i + di, j + dj})) {
continue;
}
for (auto& [x, y, n] : XY[{}]) {
for (auto& [xx, yy, nn] : XY[{i + di, j + dj}]) {
if ((x - xx) * (x - xx) + (y - yy) * (y - yy) <= 100) {
UF.merge(n, nn);
}
}
}
}
}
}
long double ans = 1;
for (auto& lst : UF.groups()) {
for (int i : lst) {
for (int j : lst) {
ans = max(ans, sqrt((long double)(X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j])) + 2);
}
}
}
cout << fixed << setprecision(10);
cout << ans << endl;
return 0;
}
vwxyz