From fd9164014656b47a44c2d5cb80b08a8d3a218941 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Thu, 1 Sep 2022 16:34:06 +0800 Subject: [PATCH] =?UTF-8?q?#3826.=20=E3=80=8CSDOI2012=E3=80=8D=E6=8B=AF?= =?UTF-8?q?=E6=95=91=E5=B0=8F=E4=BA=91=E5=85=AC=E4=B8=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://loj.ac/s/1570426 --- LibreOJ/3826/3826.cpp | 74 ++++++++++++++++++++++++++++++++++++++++ LibreOJ/3826/data/1.in | 3 ++ LibreOJ/3826/data/1.out | 3 ++ LibreOJ/3826/data/10.in | 3 ++ LibreOJ/3826/data/10.out | 3 ++ LibreOJ/3826/data/2.in | 3 ++ LibreOJ/3826/data/2.out | 3 ++ LibreOJ/3826/data/3.in | 3 ++ LibreOJ/3826/data/3.out | 3 ++ LibreOJ/3826/data/4.in | 3 ++ LibreOJ/3826/data/4.out | 3 ++ LibreOJ/3826/data/5.in | 3 ++ LibreOJ/3826/data/5.out | 3 ++ LibreOJ/3826/data/6.in | 3 ++ LibreOJ/3826/data/6.out | 3 ++ LibreOJ/3826/data/7.in | 3 ++ LibreOJ/3826/data/7.out | 3 ++ LibreOJ/3826/data/8.in | 3 ++ LibreOJ/3826/data/8.out | 3 ++ LibreOJ/3826/data/9.in | 3 ++ LibreOJ/3826/data/9.out | 3 ++ 21 files changed, 134 insertions(+) create mode 100644 LibreOJ/3826/3826.cpp create mode 100644 LibreOJ/3826/data/1.in create mode 100644 LibreOJ/3826/data/1.out create mode 100644 LibreOJ/3826/data/10.in create mode 100644 LibreOJ/3826/data/10.out create mode 100644 LibreOJ/3826/data/2.in create mode 100644 LibreOJ/3826/data/2.out create mode 100644 LibreOJ/3826/data/3.in create mode 100644 LibreOJ/3826/data/3.out create mode 100644 LibreOJ/3826/data/4.in create mode 100644 LibreOJ/3826/data/4.out create mode 100644 LibreOJ/3826/data/5.in create mode 100644 LibreOJ/3826/data/5.out create mode 100644 LibreOJ/3826/data/6.in create mode 100644 LibreOJ/3826/data/6.out create mode 100644 LibreOJ/3826/data/7.in create mode 100644 LibreOJ/3826/data/7.out create mode 100644 LibreOJ/3826/data/8.in create mode 100644 LibreOJ/3826/data/8.out create mode 100644 LibreOJ/3826/data/9.in create mode 100644 LibreOJ/3826/data/9.out diff --git a/LibreOJ/3826/3826.cpp b/LibreOJ/3826/3826.cpp new file mode 100644 index 00000000..4db85fad --- /dev/null +++ b/LibreOJ/3826/3826.cpp @@ -0,0 +1,74 @@ +#include +#include +#include +#include +#include + +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 a[N]; +bool vis[N]; + +bool check(double x) { + std::fill_n(vis, N, false); + + std::queue 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; +} diff --git a/LibreOJ/3826/data/1.in b/LibreOJ/3826/data/1.in new file mode 100644 index 00000000..b140f30e --- /dev/null +++ b/LibreOJ/3826/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efb2dcf55aba646afc9a78ea5d1fc132fc2944d084ef5965e78f8de4af5bce88 +size 23785 diff --git a/LibreOJ/3826/data/1.out b/LibreOJ/3826/data/1.out new file mode 100644 index 00000000..33480a8d --- /dev/null +++ b/LibreOJ/3826/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb11e7bb87c16284383ca1d6c1c7eb35fb28e7e3f4768e1a2937c9bfa001683d +size 7 diff --git a/LibreOJ/3826/data/10.in b/LibreOJ/3826/data/10.in new file mode 100644 index 00000000..24af847e --- /dev/null +++ b/LibreOJ/3826/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7096f6a4a2257782ea39a4e5cd6aced134e470fe6d35d95f1406084a35d44294 +size 3083 diff --git a/LibreOJ/3826/data/10.out b/LibreOJ/3826/data/10.out new file mode 100644 index 00000000..a9ea5f8e --- /dev/null +++ b/LibreOJ/3826/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec05d24ab3fd85f76dedd6a69ee9837f8b830dc86eb081ddec291d72fe465e70 +size 6 diff --git a/LibreOJ/3826/data/2.in b/LibreOJ/3826/data/2.in new file mode 100644 index 00000000..fd779e57 --- /dev/null +++ b/LibreOJ/3826/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4265298177b45424585bd71b56609fcd042bd8c5b68288872ab3c0d58d9b4482 +size 11171 diff --git a/LibreOJ/3826/data/2.out b/LibreOJ/3826/data/2.out new file mode 100644 index 00000000..cfc92c99 --- /dev/null +++ b/LibreOJ/3826/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec0ba51dd9f82d06d69c85845c52374d2590c26d5f811b7fba1f032854249552 +size 7 diff --git a/LibreOJ/3826/data/3.in b/LibreOJ/3826/data/3.in new file mode 100644 index 00000000..b49b9349 --- /dev/null +++ b/LibreOJ/3826/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecfaf54c7ec47eb8e9ca6f1551768618b776c77ead34059b0ef390bda628d643 +size 21361 diff --git a/LibreOJ/3826/data/3.out b/LibreOJ/3826/data/3.out new file mode 100644 index 00000000..87b1f1a8 --- /dev/null +++ b/LibreOJ/3826/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:415cc806f9a108f6b25ac796fafeaa50aaec4a8ea2c9753a83c08e802235b7fa +size 7 diff --git a/LibreOJ/3826/data/4.in b/LibreOJ/3826/data/4.in new file mode 100644 index 00000000..a4e3dc43 --- /dev/null +++ b/LibreOJ/3826/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eefbbeda69e7acd712a36b930e7a06315e099382bceb9e92d68bfd03cc1a5836 +size 33308 diff --git a/LibreOJ/3826/data/4.out b/LibreOJ/3826/data/4.out new file mode 100644 index 00000000..8073cdd2 --- /dev/null +++ b/LibreOJ/3826/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41df9284987ec27541650b5fc1d7a189f77ec860f86baeb5d004fbb08e9a33fa +size 6 diff --git a/LibreOJ/3826/data/5.in b/LibreOJ/3826/data/5.in new file mode 100644 index 00000000..2918ad65 --- /dev/null +++ b/LibreOJ/3826/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6915e182c866f01c86020e54322e578f377dde5bc0a281188e4a666f4aa794bf +size 15399 diff --git a/LibreOJ/3826/data/5.out b/LibreOJ/3826/data/5.out new file mode 100644 index 00000000..095b03eb --- /dev/null +++ b/LibreOJ/3826/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff836ad2d29badc3dc8dd4456bcf9bc61f4c8dec4a100644a20446fcc2b72759 +size 7 diff --git a/LibreOJ/3826/data/6.in b/LibreOJ/3826/data/6.in new file mode 100644 index 00000000..01315a04 --- /dev/null +++ b/LibreOJ/3826/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dce6e2693cce973377868d5b4eaa6664da0eea6db9385e51baefddfc1c5ddf71 +size 1076 diff --git a/LibreOJ/3826/data/6.out b/LibreOJ/3826/data/6.out new file mode 100644 index 00000000..b58660e6 --- /dev/null +++ b/LibreOJ/3826/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b12889d852ec6e9d88defa5839770c164b799727e72d0eb415f8b5e7c85313f0 +size 7 diff --git a/LibreOJ/3826/data/7.in b/LibreOJ/3826/data/7.in new file mode 100644 index 00000000..8b099f70 --- /dev/null +++ b/LibreOJ/3826/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e57ed97a23dbe566f7d5d04b0c2fd5a3126ae60150ea9381e49d13dcc40118ad +size 63 diff --git a/LibreOJ/3826/data/7.out b/LibreOJ/3826/data/7.out new file mode 100644 index 00000000..6d5a2471 --- /dev/null +++ b/LibreOJ/3826/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ca59e0f752bbde9b4610f759bb160c7a727a5066fd100690fa96c305e7a5ba6 +size 5 diff --git a/LibreOJ/3826/data/8.in b/LibreOJ/3826/data/8.in new file mode 100644 index 00000000..c6c96642 --- /dev/null +++ b/LibreOJ/3826/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae766a761743b04d6f0897d1f3b288026fad1c49cf3a86f554f0e8e840baef34 +size 31959 diff --git a/LibreOJ/3826/data/8.out b/LibreOJ/3826/data/8.out new file mode 100644 index 00000000..82499f8c --- /dev/null +++ b/LibreOJ/3826/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1198c2b06f0eaa776a402e83b463f5004c3a02a420742aae8ecd724e13c2e97a +size 7 diff --git a/LibreOJ/3826/data/9.in b/LibreOJ/3826/data/9.in new file mode 100644 index 00000000..6965bd50 --- /dev/null +++ b/LibreOJ/3826/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8bbaf14c70f86bf377926531c6812697f23b7e0c6b06260a02549852e09c189 +size 49 diff --git a/LibreOJ/3826/data/9.out b/LibreOJ/3826/data/9.out new file mode 100644 index 00000000..7f9ea881 --- /dev/null +++ b/LibreOJ/3826/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:473ef839574c0cc9d5ec4bd32628e95ae722737c5b1836a48e731e2b3618dc57 +size 5