0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-08 15:18:46 +00:00

3007. 拯救小云公主

https://hydro.ac/d/bzoj/record/6322c13a32ae6c3198cc6b28
This commit is contained in:
Baoshuo Ren 2022-09-15 14:07:57 +08:00
parent a3280eb4f0
commit 4a3a25865d
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
21 changed files with 134 additions and 0 deletions

74
BZOJ/3007/3007.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
BZOJ/3007/data/1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3007/data/9.out (Stored with Git LFS) Normal file

Binary file not shown.