0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

#3826. 「SDOI2012」拯救小云公主

https://loj.ac/s/1570426
This commit is contained in:
Baoshuo Ren 2022-09-01 16:34:06 +08:00
parent 2bbd7d5523
commit fd91640146
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
21 changed files with 134 additions and 0 deletions

74
LibreOJ/3826/3826.cpp Normal file
View File

@ -0,0 +1,74 @@
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <queue>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 3005;
const double eps = 1e-4;
int n, row, line;
std::pair<int, int> a[N];
bool vis[N];
bool check(double x) {
std::fill_n(vis, N, false);
std::queue<int> q;
for (int i = 1; i <= n; i++) {
if (a[i].first - 1 < x || line - a[i].second < x) {
vis[i] = true;
q.push(i);
}
}
while (!q.empty()) {
auto u = q.front();
q.pop();
if (row - a[u].first < x || a[u].second - 1 < x) {
return false;
}
for (int i = 1; i <= n; i++) {
if (!vis[i] && std::sqrt(std::pow(a[u].first - a[i].first, 2) + std::pow(a[u].second - a[i].second, 2)) < x * 2) {
vis[i] = true;
q.push(i);
}
}
}
return true;
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> row >> line;
for (int i = 1; i <= n; i++) {
cin >> a[i].first >> a[i].second;
}
double l = 0, r = std::min(row, line);
while (r - l > eps) {
double mid = (l + r) / 2;
if (check(mid)) {
l = mid;
} else {
r = mid;
}
}
cout << std::fixed << std::setprecision(2) << l << endl;
return 0;
}

BIN
LibreOJ/3826/data/1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3826/data/9.out (Stored with Git LFS) Normal file

Binary file not shown.