From a0eb9a2927af25f9c527be46461cb88e2dd9f025 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 5 Sep 2022 15:23:33 +0800 Subject: [PATCH] =?UTF-8?q?#1537.=20=E3=80=902022.09.05NOIP=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E9=A2=98=E3=80=91=E5=9B=BD=E5=A2=83=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/55837 --- S2OJ/1537/1537.cpp | 75 +++++++++++++++++++++++++++++++++++ S2OJ/1537/data/boundary1.in | 3 ++ S2OJ/1537/data/boundary1.out | 3 ++ S2OJ/1537/data/boundary10.in | 3 ++ S2OJ/1537/data/boundary10.out | 3 ++ S2OJ/1537/data/boundary2.in | 3 ++ S2OJ/1537/data/boundary2.out | 3 ++ S2OJ/1537/data/boundary3.in | 3 ++ S2OJ/1537/data/boundary3.out | 3 ++ S2OJ/1537/data/boundary4.in | 3 ++ S2OJ/1537/data/boundary4.out | 3 ++ S2OJ/1537/data/boundary5.in | 3 ++ S2OJ/1537/data/boundary5.out | 3 ++ S2OJ/1537/data/boundary6.in | 3 ++ S2OJ/1537/data/boundary6.out | 3 ++ S2OJ/1537/data/boundary7.in | 3 ++ S2OJ/1537/data/boundary7.out | 3 ++ S2OJ/1537/data/boundary8.in | 3 ++ S2OJ/1537/data/boundary8.out | 3 ++ S2OJ/1537/data/boundary9.in | 3 ++ S2OJ/1537/data/boundary9.out | 3 ++ S2OJ/1537/data/problem.conf | 3 ++ 22 files changed, 138 insertions(+) create mode 100644 S2OJ/1537/1537.cpp create mode 100644 S2OJ/1537/data/boundary1.in create mode 100644 S2OJ/1537/data/boundary1.out create mode 100644 S2OJ/1537/data/boundary10.in create mode 100644 S2OJ/1537/data/boundary10.out create mode 100644 S2OJ/1537/data/boundary2.in create mode 100644 S2OJ/1537/data/boundary2.out create mode 100644 S2OJ/1537/data/boundary3.in create mode 100644 S2OJ/1537/data/boundary3.out create mode 100644 S2OJ/1537/data/boundary4.in create mode 100644 S2OJ/1537/data/boundary4.out create mode 100644 S2OJ/1537/data/boundary5.in create mode 100644 S2OJ/1537/data/boundary5.out create mode 100644 S2OJ/1537/data/boundary6.in create mode 100644 S2OJ/1537/data/boundary6.out create mode 100644 S2OJ/1537/data/boundary7.in create mode 100644 S2OJ/1537/data/boundary7.out create mode 100644 S2OJ/1537/data/boundary8.in create mode 100644 S2OJ/1537/data/boundary8.out create mode 100644 S2OJ/1537/data/boundary9.in create mode 100644 S2OJ/1537/data/boundary9.out create mode 100644 S2OJ/1537/data/problem.conf diff --git a/S2OJ/1537/1537.cpp b/S2OJ/1537/1537.cpp new file mode 100644 index 00000000..19fdc62b --- /dev/null +++ b/S2OJ/1537/1537.cpp @@ -0,0 +1,75 @@ +#include +#include +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 3005; +const int d[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; + +int n, m, k, q, id[N][N], dist[N][N], ans; +std::queue> queue; +bool g[N][N]; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + memset(dist, -0x3f, sizeof(dist)); + + cin >> n >> m >> k; + + for (int i = 1, x, y; i <= k; i++) { + cin >> x >> y; + + id[x][y] = i; + dist[x][y] = 0; + + queue.emplace(x, y); + } + + cin >> q; + + for (int i = 1, x, y; i <= q; i++) { + cin >> x >> y; + + g[x][y] = true; + } + + while (!queue.empty()) { + int x, y; + + std::tie(x, y) = queue.front(); + queue.pop(); + + for (const auto &d : d) { + int xx = x + d[0], + yy = y + d[1]; + + if (xx < 1 || xx > n || yy < 1 || yy > m || g[xx][yy]) continue; + + if (id[xx][yy] == 0) { + id[xx][yy] = id[x][y]; + dist[xx][yy] = dist[x][y] + 1; + + queue.emplace(xx, yy); + } else if (dist[x][y] + 1 == dist[xx][yy] && id[x][y] != id[xx][yy]) { + id[xx][yy] = -1; + } + } + } + + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= m; j++) { + if (id[i][j] == -1) ans++; + } + } + + cout << ans << endl; + + return 0; +} diff --git a/S2OJ/1537/data/boundary1.in b/S2OJ/1537/data/boundary1.in new file mode 100644 index 00000000..2a68420c --- /dev/null +++ b/S2OJ/1537/data/boundary1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59653ef5bed3a82aac9e96337d6e470937bf9296c72a38cbb7621c80951d73c9 +size 136 diff --git a/S2OJ/1537/data/boundary1.out b/S2OJ/1537/data/boundary1.out new file mode 100644 index 00000000..30cff407 --- /dev/null +++ b/S2OJ/1537/data/boundary1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcea5d7d8b256f1bda5f90a3ede41899e94b89fccb4e4d2786073b5bfaa0002a +size 4 diff --git a/S2OJ/1537/data/boundary10.in b/S2OJ/1537/data/boundary10.in new file mode 100644 index 00000000..d9b0148d --- /dev/null +++ b/S2OJ/1537/data/boundary10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e666dd14440f9e69eb82d01e6930fb0db5a8601ebafe7a17a83ac9c804d3de6 +size 23899 diff --git a/S2OJ/1537/data/boundary10.out b/S2OJ/1537/data/boundary10.out new file mode 100644 index 00000000..3b9b01ef --- /dev/null +++ b/S2OJ/1537/data/boundary10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8fef92f40a2ffeb01dee7f0352eddb96dce2f220a521eba7bbf33f405d26c1a1 +size 7 diff --git a/S2OJ/1537/data/boundary2.in b/S2OJ/1537/data/boundary2.in new file mode 100644 index 00000000..158560e0 --- /dev/null +++ b/S2OJ/1537/data/boundary2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c0221fd3a134dcdb9a6758baa9f4bf6a73a65ee66704275f0e5c4466b91e758 +size 107 diff --git a/S2OJ/1537/data/boundary2.out b/S2OJ/1537/data/boundary2.out new file mode 100644 index 00000000..5ce3cd1e --- /dev/null +++ b/S2OJ/1537/data/boundary2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93a73825c1b761d11bf2b3f4dff760d07888d3fde05dcf55f1da84aa6041a5a8 +size 3 diff --git a/S2OJ/1537/data/boundary3.in b/S2OJ/1537/data/boundary3.in new file mode 100644 index 00000000..bc629181 --- /dev/null +++ b/S2OJ/1537/data/boundary3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c47feceb00f9753b4a0bf08195fb533d56b4570896ec819d60fc408661e589e9 +size 1198 diff --git a/S2OJ/1537/data/boundary3.out b/S2OJ/1537/data/boundary3.out new file mode 100644 index 00000000..f390bdd8 --- /dev/null +++ b/S2OJ/1537/data/boundary3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e36f128ce9080e9fdd32c91a06816f56793abd186eb983415c44b8799cc773c +size 5 diff --git a/S2OJ/1537/data/boundary4.in b/S2OJ/1537/data/boundary4.in new file mode 100644 index 00000000..0b8a6f1f --- /dev/null +++ b/S2OJ/1537/data/boundary4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:498a7324309b6fc1df22c50e89fc7edfc124a039178b62d9a093ff335a230f6a +size 1296 diff --git a/S2OJ/1537/data/boundary4.out b/S2OJ/1537/data/boundary4.out new file mode 100644 index 00000000..0718c942 --- /dev/null +++ b/S2OJ/1537/data/boundary4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9a7b1885a5af34c78a324307c0481d0a1fb509459329a114166e6805b168266 +size 5 diff --git a/S2OJ/1537/data/boundary5.in b/S2OJ/1537/data/boundary5.in new file mode 100644 index 00000000..7799481e --- /dev/null +++ b/S2OJ/1537/data/boundary5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d59bc577f1ffc2bf2c6b0c786eb8893fc0cf568aea3f0630099499bceb569b44 +size 13267 diff --git a/S2OJ/1537/data/boundary5.out b/S2OJ/1537/data/boundary5.out new file mode 100644 index 00000000..b62a0f44 --- /dev/null +++ b/S2OJ/1537/data/boundary5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62a39322a68b3aefc9cacf2e79dade6e86154c7031362a5f4fa51592e91cbc70 +size 7 diff --git a/S2OJ/1537/data/boundary6.in b/S2OJ/1537/data/boundary6.in new file mode 100644 index 00000000..3f5680b5 --- /dev/null +++ b/S2OJ/1537/data/boundary6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0e690e594b1998a3354e4040ce0f9fd946770915b76db309a6263d5e491f9eb +size 10513 diff --git a/S2OJ/1537/data/boundary6.out b/S2OJ/1537/data/boundary6.out new file mode 100644 index 00000000..2297bbe3 --- /dev/null +++ b/S2OJ/1537/data/boundary6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5e3c4fb6db653039b449b0c64cb9daf1af5d2b84ddaf720891d650b98a09ce2 +size 6 diff --git a/S2OJ/1537/data/boundary7.in b/S2OJ/1537/data/boundary7.in new file mode 100644 index 00000000..8c0f028e --- /dev/null +++ b/S2OJ/1537/data/boundary7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b907b48e6dbf304a2a9c2c87356cb6d9e8bd8c4bded60bba1737195b756514b +size 11090 diff --git a/S2OJ/1537/data/boundary7.out b/S2OJ/1537/data/boundary7.out new file mode 100644 index 00000000..f1ac6ec4 --- /dev/null +++ b/S2OJ/1537/data/boundary7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:129878a3e3f447f4c3bb0f95d66cb4c54cc459b509f1df5b7775bc52737686db +size 7 diff --git a/S2OJ/1537/data/boundary8.in b/S2OJ/1537/data/boundary8.in new file mode 100644 index 00000000..4c65ea0b --- /dev/null +++ b/S2OJ/1537/data/boundary8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45990a3ab6c64516d1b85d76771998094e8f049ae985cea4dffdad7fe77e48ea +size 16735 diff --git a/S2OJ/1537/data/boundary8.out b/S2OJ/1537/data/boundary8.out new file mode 100644 index 00000000..1d9537fa --- /dev/null +++ b/S2OJ/1537/data/boundary8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b79ed63d584c28e271b772d8ed0ec12ebf520ba2591d68d173f0b545d8cc293c +size 7 diff --git a/S2OJ/1537/data/boundary9.in b/S2OJ/1537/data/boundary9.in new file mode 100644 index 00000000..6466abf2 --- /dev/null +++ b/S2OJ/1537/data/boundary9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e5fec03893428887120bf86086a3819f444c28d1bcda2f90aa0b42a375160ae +size 17917 diff --git a/S2OJ/1537/data/boundary9.out b/S2OJ/1537/data/boundary9.out new file mode 100644 index 00000000..e1aa2908 --- /dev/null +++ b/S2OJ/1537/data/boundary9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9afe6c4af79edf4d4469c12631ed0524b4ae5bc050bde08a1d7393861870daf +size 7 diff --git a/S2OJ/1537/data/problem.conf b/S2OJ/1537/data/problem.conf new file mode 100644 index 00000000..672d926f --- /dev/null +++ b/S2OJ/1537/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:341b80bb9778e8ec56f70e08565bde272913a7aca3d2373e64c2492bc29ff172 +size 185