From 6b572e15fa8eb816db596c49c0f1e909add82dd2 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sun, 12 Nov 2023 16:47:24 +0800 Subject: [PATCH] =?UTF-8?q?P9752=20[CSP-S=202023]=20=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.luogu.com.cn/record/134755461 --- Luogu/P9752/P9752.cpp | 78 +++++++++++++++++++++++++++++++++++ Luogu/P9752/data/P9752_1.in | 3 ++ Luogu/P9752/data/P9752_1.out | 3 ++ Luogu/P9752/data/P9752_10.in | 3 ++ Luogu/P9752/data/P9752_10.out | 3 ++ Luogu/P9752/data/P9752_2.in | 3 ++ Luogu/P9752/data/P9752_2.out | 3 ++ Luogu/P9752/data/P9752_3.in | 3 ++ Luogu/P9752/data/P9752_3.out | 3 ++ Luogu/P9752/data/P9752_4.in | 3 ++ Luogu/P9752/data/P9752_4.out | 3 ++ Luogu/P9752/data/P9752_5.in | 3 ++ Luogu/P9752/data/P9752_5.out | 3 ++ Luogu/P9752/data/P9752_6.in | 3 ++ Luogu/P9752/data/P9752_6.out | 3 ++ Luogu/P9752/data/P9752_7.in | 3 ++ Luogu/P9752/data/P9752_7.out | 3 ++ Luogu/P9752/data/P9752_8.in | 3 ++ Luogu/P9752/data/P9752_8.out | 3 ++ Luogu/P9752/data/P9752_9.in | 3 ++ Luogu/P9752/data/P9752_9.out | 3 ++ Luogu/P9752/samples/lock1.ans | 3 ++ Luogu/P9752/samples/lock1.in | 3 ++ Luogu/P9752/samples/lock2.ans | 3 ++ Luogu/P9752/samples/lock2.in | 3 ++ 25 files changed, 150 insertions(+) create mode 100644 Luogu/P9752/P9752.cpp create mode 100644 Luogu/P9752/data/P9752_1.in create mode 100644 Luogu/P9752/data/P9752_1.out create mode 100644 Luogu/P9752/data/P9752_10.in create mode 100644 Luogu/P9752/data/P9752_10.out create mode 100644 Luogu/P9752/data/P9752_2.in create mode 100644 Luogu/P9752/data/P9752_2.out create mode 100644 Luogu/P9752/data/P9752_3.in create mode 100644 Luogu/P9752/data/P9752_3.out create mode 100644 Luogu/P9752/data/P9752_4.in create mode 100644 Luogu/P9752/data/P9752_4.out create mode 100644 Luogu/P9752/data/P9752_5.in create mode 100644 Luogu/P9752/data/P9752_5.out create mode 100644 Luogu/P9752/data/P9752_6.in create mode 100644 Luogu/P9752/data/P9752_6.out create mode 100644 Luogu/P9752/data/P9752_7.in create mode 100644 Luogu/P9752/data/P9752_7.out create mode 100644 Luogu/P9752/data/P9752_8.in create mode 100644 Luogu/P9752/data/P9752_8.out create mode 100644 Luogu/P9752/data/P9752_9.in create mode 100644 Luogu/P9752/data/P9752_9.out create mode 100644 Luogu/P9752/samples/lock1.ans create mode 100644 Luogu/P9752/samples/lock1.in create mode 100644 Luogu/P9752/samples/lock2.ans create mode 100644 Luogu/P9752/samples/lock2.in diff --git a/Luogu/P9752/P9752.cpp b/Luogu/P9752/P9752.cpp new file mode 100644 index 00000000..70dfb964 --- /dev/null +++ b/Luogu/P9752/P9752.cpp @@ -0,0 +1,78 @@ +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 10, + M = 5; + +int n, ans; +std::array a[N]; +std::set> set_pre; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n; + + for (int i = 1; i <= n; i++) { + for (int j = 0; j < M; j++) { + cin >> a[i][j]; + } + } + + for (int i = 1; i <= n; i++) { + std::set> set_now; + + // Type 1: Only one element is different. + for (int j = 0; j < M; j++) { + std::array t = a[i]; + + for (int k = 0; k < 10; k++) { + t[j] = (a[i][j] + k) % 10; + + if (t[j] != a[i][j]) { + set_now.emplace(t); + } + } + } + + // Type 2: Two adjacent elements are different. + for (int j = 0; j + 1 < M; j++) { + std::array t = a[i]; + + for (int k = 0; k < 10; k++) { + t[j] = (a[i][j] + k) % 10; + t[j + 1] = (a[i][j + 1] + k) % 10; + + if (t[j] != a[i][j]) { + set_now.emplace(t); + } + } + } + + if (i == 1) { + ans = set_now.size(); + set_pre = set_now; + } else { + std::set> set; + + for (auto o : set_pre) { + if (set_now.count(o)) { + set.emplace(o); + } + } + + ans = set.size(); + set_pre = set; + } + } + + cout << ans << endl; + + return 0; +} diff --git a/Luogu/P9752/data/P9752_1.in b/Luogu/P9752/data/P9752_1.in new file mode 100644 index 00000000..85f043bb --- /dev/null +++ b/Luogu/P9752/data/P9752_1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5447c385983b9bb8f2ca28638dd388edee0c6a521577093f7b96f83318f48953 +size 12 diff --git a/Luogu/P9752/data/P9752_1.out b/Luogu/P9752/data/P9752_1.out new file mode 100644 index 00000000..1d0769d4 --- /dev/null +++ b/Luogu/P9752/data/P9752_1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce516e29a2ccfe4bab40e4e6adab7661cd695680482c00b1faa738fc0df62698 +size 3 diff --git a/Luogu/P9752/data/P9752_10.in b/Luogu/P9752/data/P9752_10.in new file mode 100644 index 00000000..de019211 --- /dev/null +++ b/Luogu/P9752/data/P9752_10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b044d192e06b379c39eefb5b52a47c558986b3bc5fc0a835d6f30f357b5abeb +size 82 diff --git a/Luogu/P9752/data/P9752_10.out b/Luogu/P9752/data/P9752_10.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/Luogu/P9752/data/P9752_10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/Luogu/P9752/data/P9752_2.in b/Luogu/P9752/data/P9752_2.in new file mode 100644 index 00000000..365066e7 --- /dev/null +++ b/Luogu/P9752/data/P9752_2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6103d63bf9e7f554360fb46ce02e3158b570a3437c88c553a0fcf041b9cae2bd +size 12 diff --git a/Luogu/P9752/data/P9752_2.out b/Luogu/P9752/data/P9752_2.out new file mode 100644 index 00000000..1d0769d4 --- /dev/null +++ b/Luogu/P9752/data/P9752_2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce516e29a2ccfe4bab40e4e6adab7661cd695680482c00b1faa738fc0df62698 +size 3 diff --git a/Luogu/P9752/data/P9752_3.in b/Luogu/P9752/data/P9752_3.in new file mode 100644 index 00000000..4eb36fe3 --- /dev/null +++ b/Luogu/P9752/data/P9752_3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7b211a8a6f7113ed8aa3a8325c6c6f6a843521a7c0d6e9cbb4a522d95fa5d3b +size 12 diff --git a/Luogu/P9752/data/P9752_3.out b/Luogu/P9752/data/P9752_3.out new file mode 100644 index 00000000..1d0769d4 --- /dev/null +++ b/Luogu/P9752/data/P9752_3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce516e29a2ccfe4bab40e4e6adab7661cd695680482c00b1faa738fc0df62698 +size 3 diff --git a/Luogu/P9752/data/P9752_4.in b/Luogu/P9752/data/P9752_4.in new file mode 100644 index 00000000..aacc7496 --- /dev/null +++ b/Luogu/P9752/data/P9752_4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d75040d41ec4bc404bb76667b0427a385f49235296bd320e867f2d6fdcbc724b +size 22 diff --git a/Luogu/P9752/data/P9752_4.out b/Luogu/P9752/data/P9752_4.out new file mode 100644 index 00000000..cb90f684 --- /dev/null +++ b/Luogu/P9752/data/P9752_4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06e9d52c1720fca412803e3b07c4b228ff113e303f4c7ab94665319d832bbfb7 +size 2 diff --git a/Luogu/P9752/data/P9752_5.in b/Luogu/P9752/data/P9752_5.in new file mode 100644 index 00000000..88803145 --- /dev/null +++ b/Luogu/P9752/data/P9752_5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e17d262c8a172d924007c50cd0b88f9d4fd78e8d2d3c97d307cd251e0637dca8 +size 22 diff --git a/Luogu/P9752/data/P9752_5.out b/Luogu/P9752/data/P9752_5.out new file mode 100644 index 00000000..38118f32 --- /dev/null +++ b/Luogu/P9752/data/P9752_5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53c234e5e8472b6ac51c1ae1cab3fe06fad053beb8ebfd8977b010655bfdd3c3 +size 2 diff --git a/Luogu/P9752/data/P9752_6.in b/Luogu/P9752/data/P9752_6.in new file mode 100644 index 00000000..63dd7dc8 --- /dev/null +++ b/Luogu/P9752/data/P9752_6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b23a9f06d6b15a169af5bee9e112441b17e79c6c42d57b78661608ce7cd9f33 +size 42 diff --git a/Luogu/P9752/data/P9752_6.out b/Luogu/P9752/data/P9752_6.out new file mode 100644 index 00000000..cb90f684 --- /dev/null +++ b/Luogu/P9752/data/P9752_6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06e9d52c1720fca412803e3b07c4b228ff113e303f4c7ab94665319d832bbfb7 +size 2 diff --git a/Luogu/P9752/data/P9752_7.in b/Luogu/P9752/data/P9752_7.in new file mode 100644 index 00000000..262ed1a0 --- /dev/null +++ b/Luogu/P9752/data/P9752_7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56fee0853af706fe50d03c096860b526d1d9ccee70bdb0e8107aeae34a34a209 +size 62 diff --git a/Luogu/P9752/data/P9752_7.out b/Luogu/P9752/data/P9752_7.out new file mode 100644 index 00000000..d595cdb8 --- /dev/null +++ b/Luogu/P9752/data/P9752_7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7de1555df0c2700329e815b93b32c571c3ea54dc967b89e81ab73b9972b72d1d +size 2 diff --git a/Luogu/P9752/data/P9752_8.in b/Luogu/P9752/data/P9752_8.in new file mode 100644 index 00000000..53db76e8 --- /dev/null +++ b/Luogu/P9752/data/P9752_8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fe8323b9c9cf34557a004c4f44d6146ac752cce1bf0e45f7b7481bf516eead7 +size 72 diff --git a/Luogu/P9752/data/P9752_8.out b/Luogu/P9752/data/P9752_8.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/Luogu/P9752/data/P9752_8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/Luogu/P9752/data/P9752_9.in b/Luogu/P9752/data/P9752_9.in new file mode 100644 index 00000000..6255d6be --- /dev/null +++ b/Luogu/P9752/data/P9752_9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbeff97e1b3620a27a0c27398e50a80522216261b8ad41ea949d40f67d1a90bc +size 52 diff --git a/Luogu/P9752/data/P9752_9.out b/Luogu/P9752/data/P9752_9.out new file mode 100644 index 00000000..d76a596d --- /dev/null +++ b/Luogu/P9752/data/P9752_9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0b5c2c2211c8d67ed15e75e656c7862d086e9245420892a7de62cd9ec582a06 +size 2 diff --git a/Luogu/P9752/samples/lock1.ans b/Luogu/P9752/samples/lock1.ans new file mode 100644 index 00000000..1d0769d4 --- /dev/null +++ b/Luogu/P9752/samples/lock1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce516e29a2ccfe4bab40e4e6adab7661cd695680482c00b1faa738fc0df62698 +size 3 diff --git a/Luogu/P9752/samples/lock1.in b/Luogu/P9752/samples/lock1.in new file mode 100644 index 00000000..4e350a54 --- /dev/null +++ b/Luogu/P9752/samples/lock1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd845a30612361363943c5a8b3470f774015083dccf36f6ac03a67769a94af8f +size 12 diff --git a/Luogu/P9752/samples/lock2.ans b/Luogu/P9752/samples/lock2.ans new file mode 100644 index 00000000..f4808fee --- /dev/null +++ b/Luogu/P9752/samples/lock2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:917df3320d778ddbaa5c5c7742bc4046bf803c36ed2b050f30844ed206783469 +size 3 diff --git a/Luogu/P9752/samples/lock2.in b/Luogu/P9752/samples/lock2.in new file mode 100644 index 00000000..440dd396 --- /dev/null +++ b/Luogu/P9752/samples/lock2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46742ad4b960b07400c07ee5aa7d61b4bf7d006466e32ceec7d0b13fdc6305e1 +size 22