結果
問題 | No.96 圏外です。 |
ユーザー |
![]() |
提出日時 | 2024-05-03 16:23:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,309 bytes |
コンパイル時間 | 3,084 ms |
コンパイル使用メモリ | 268,112 KB |
実行使用メモリ | 24,420 KB |
最終ジャッジ日時 | 2024-11-24 18:48:34 |
合計ジャッジ時間 | 7,864 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 25 |
ソースコード
#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); } } } } } } double ans = 1; for (auto& lst : UF.groups()) { for (int i : lst) { for (int j : lst) { ans = max(ans, sqrt((X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j])) + 2); } } } cout << ans << endl; return 0; }