From 866d42f1b31e15b1e8b638a06fa01279aac985ab Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Tue, 14 Nov 2023 20:04:41 +0800 Subject: [PATCH] =?UTF-8?q?#3994.=20=E3=80=8CCSP-S=202023=E3=80=8D?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://loj.ac/s/1935456 --- LibreOJ/3994/3994.cpp | 81 ++++++++++++++++++++++++++++++++++ LibreOJ/3994/data/lock1.ans | 3 ++ LibreOJ/3994/data/lock1.in | 3 ++ LibreOJ/3994/data/lock10.ans | 3 ++ LibreOJ/3994/data/lock10.in | 3 ++ LibreOJ/3994/data/lock2.ans | 3 ++ LibreOJ/3994/data/lock2.in | 3 ++ LibreOJ/3994/data/lock3.ans | 3 ++ LibreOJ/3994/data/lock3.in | 3 ++ LibreOJ/3994/data/lock4.ans | 3 ++ LibreOJ/3994/data/lock4.in | 3 ++ LibreOJ/3994/data/lock5.ans | 3 ++ LibreOJ/3994/data/lock5.in | 3 ++ LibreOJ/3994/data/lock6.ans | 3 ++ LibreOJ/3994/data/lock6.in | 3 ++ LibreOJ/3994/data/lock7.ans | 3 ++ LibreOJ/3994/data/lock7.in | 3 ++ LibreOJ/3994/data/lock8.ans | 3 ++ LibreOJ/3994/data/lock8.in | 3 ++ LibreOJ/3994/data/lock9.ans | 3 ++ LibreOJ/3994/data/lock9.in | 3 ++ LibreOJ/3994/samples/lock1.ans | 3 ++ LibreOJ/3994/samples/lock1.in | 3 ++ LibreOJ/3994/samples/lock2.ans | 3 ++ LibreOJ/3994/samples/lock2.in | 3 ++ 25 files changed, 153 insertions(+) create mode 100644 LibreOJ/3994/3994.cpp create mode 100644 LibreOJ/3994/data/lock1.ans create mode 100644 LibreOJ/3994/data/lock1.in create mode 100644 LibreOJ/3994/data/lock10.ans create mode 100644 LibreOJ/3994/data/lock10.in create mode 100644 LibreOJ/3994/data/lock2.ans create mode 100644 LibreOJ/3994/data/lock2.in create mode 100644 LibreOJ/3994/data/lock3.ans create mode 100644 LibreOJ/3994/data/lock3.in create mode 100644 LibreOJ/3994/data/lock4.ans create mode 100644 LibreOJ/3994/data/lock4.in create mode 100644 LibreOJ/3994/data/lock5.ans create mode 100644 LibreOJ/3994/data/lock5.in create mode 100644 LibreOJ/3994/data/lock6.ans create mode 100644 LibreOJ/3994/data/lock6.in create mode 100644 LibreOJ/3994/data/lock7.ans create mode 100644 LibreOJ/3994/data/lock7.in create mode 100644 LibreOJ/3994/data/lock8.ans create mode 100644 LibreOJ/3994/data/lock8.in create mode 100644 LibreOJ/3994/data/lock9.ans create mode 100644 LibreOJ/3994/data/lock9.in create mode 100644 LibreOJ/3994/samples/lock1.ans create mode 100644 LibreOJ/3994/samples/lock1.in create mode 100644 LibreOJ/3994/samples/lock2.ans create mode 100644 LibreOJ/3994/samples/lock2.in diff --git a/LibreOJ/3994/3994.cpp b/LibreOJ/3994/3994.cpp new file mode 100644 index 00000000..f1c9fc94 --- /dev/null +++ b/LibreOJ/3994/3994.cpp @@ -0,0 +1,81 @@ +#include +#include +#include +#include + +// using std::cin; +// using std::cout; +std::ifstream cin("lock.in"); +std::ofstream cout("lock.out"); +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/LibreOJ/3994/data/lock1.ans b/LibreOJ/3994/data/lock1.ans new file mode 100644 index 00000000..1d0769d4 --- /dev/null +++ b/LibreOJ/3994/data/lock1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce516e29a2ccfe4bab40e4e6adab7661cd695680482c00b1faa738fc0df62698 +size 3 diff --git a/LibreOJ/3994/data/lock1.in b/LibreOJ/3994/data/lock1.in new file mode 100644 index 00000000..85f043bb --- /dev/null +++ b/LibreOJ/3994/data/lock1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5447c385983b9bb8f2ca28638dd388edee0c6a521577093f7b96f83318f48953 +size 12 diff --git a/LibreOJ/3994/data/lock10.ans b/LibreOJ/3994/data/lock10.ans new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/LibreOJ/3994/data/lock10.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/LibreOJ/3994/data/lock10.in b/LibreOJ/3994/data/lock10.in new file mode 100644 index 00000000..de019211 --- /dev/null +++ b/LibreOJ/3994/data/lock10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b044d192e06b379c39eefb5b52a47c558986b3bc5fc0a835d6f30f357b5abeb +size 82 diff --git a/LibreOJ/3994/data/lock2.ans b/LibreOJ/3994/data/lock2.ans new file mode 100644 index 00000000..1d0769d4 --- /dev/null +++ b/LibreOJ/3994/data/lock2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce516e29a2ccfe4bab40e4e6adab7661cd695680482c00b1faa738fc0df62698 +size 3 diff --git a/LibreOJ/3994/data/lock2.in b/LibreOJ/3994/data/lock2.in new file mode 100644 index 00000000..365066e7 --- /dev/null +++ b/LibreOJ/3994/data/lock2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6103d63bf9e7f554360fb46ce02e3158b570a3437c88c553a0fcf041b9cae2bd +size 12 diff --git a/LibreOJ/3994/data/lock3.ans b/LibreOJ/3994/data/lock3.ans new file mode 100644 index 00000000..1d0769d4 --- /dev/null +++ b/LibreOJ/3994/data/lock3.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce516e29a2ccfe4bab40e4e6adab7661cd695680482c00b1faa738fc0df62698 +size 3 diff --git a/LibreOJ/3994/data/lock3.in b/LibreOJ/3994/data/lock3.in new file mode 100644 index 00000000..4eb36fe3 --- /dev/null +++ b/LibreOJ/3994/data/lock3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7b211a8a6f7113ed8aa3a8325c6c6f6a843521a7c0d6e9cbb4a522d95fa5d3b +size 12 diff --git a/LibreOJ/3994/data/lock4.ans b/LibreOJ/3994/data/lock4.ans new file mode 100644 index 00000000..cb90f684 --- /dev/null +++ b/LibreOJ/3994/data/lock4.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06e9d52c1720fca412803e3b07c4b228ff113e303f4c7ab94665319d832bbfb7 +size 2 diff --git a/LibreOJ/3994/data/lock4.in b/LibreOJ/3994/data/lock4.in new file mode 100644 index 00000000..aacc7496 --- /dev/null +++ b/LibreOJ/3994/data/lock4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d75040d41ec4bc404bb76667b0427a385f49235296bd320e867f2d6fdcbc724b +size 22 diff --git a/LibreOJ/3994/data/lock5.ans b/LibreOJ/3994/data/lock5.ans new file mode 100644 index 00000000..38118f32 --- /dev/null +++ b/LibreOJ/3994/data/lock5.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53c234e5e8472b6ac51c1ae1cab3fe06fad053beb8ebfd8977b010655bfdd3c3 +size 2 diff --git a/LibreOJ/3994/data/lock5.in b/LibreOJ/3994/data/lock5.in new file mode 100644 index 00000000..88803145 --- /dev/null +++ b/LibreOJ/3994/data/lock5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e17d262c8a172d924007c50cd0b88f9d4fd78e8d2d3c97d307cd251e0637dca8 +size 22 diff --git a/LibreOJ/3994/data/lock6.ans b/LibreOJ/3994/data/lock6.ans new file mode 100644 index 00000000..cb90f684 --- /dev/null +++ b/LibreOJ/3994/data/lock6.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06e9d52c1720fca412803e3b07c4b228ff113e303f4c7ab94665319d832bbfb7 +size 2 diff --git a/LibreOJ/3994/data/lock6.in b/LibreOJ/3994/data/lock6.in new file mode 100644 index 00000000..63dd7dc8 --- /dev/null +++ b/LibreOJ/3994/data/lock6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b23a9f06d6b15a169af5bee9e112441b17e79c6c42d57b78661608ce7cd9f33 +size 42 diff --git a/LibreOJ/3994/data/lock7.ans b/LibreOJ/3994/data/lock7.ans new file mode 100644 index 00000000..d595cdb8 --- /dev/null +++ b/LibreOJ/3994/data/lock7.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7de1555df0c2700329e815b93b32c571c3ea54dc967b89e81ab73b9972b72d1d +size 2 diff --git a/LibreOJ/3994/data/lock7.in b/LibreOJ/3994/data/lock7.in new file mode 100644 index 00000000..262ed1a0 --- /dev/null +++ b/LibreOJ/3994/data/lock7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56fee0853af706fe50d03c096860b526d1d9ccee70bdb0e8107aeae34a34a209 +size 62 diff --git a/LibreOJ/3994/data/lock8.ans b/LibreOJ/3994/data/lock8.ans new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/LibreOJ/3994/data/lock8.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/LibreOJ/3994/data/lock8.in b/LibreOJ/3994/data/lock8.in new file mode 100644 index 00000000..53db76e8 --- /dev/null +++ b/LibreOJ/3994/data/lock8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fe8323b9c9cf34557a004c4f44d6146ac752cce1bf0e45f7b7481bf516eead7 +size 72 diff --git a/LibreOJ/3994/data/lock9.ans b/LibreOJ/3994/data/lock9.ans new file mode 100644 index 00000000..d76a596d --- /dev/null +++ b/LibreOJ/3994/data/lock9.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0b5c2c2211c8d67ed15e75e656c7862d086e9245420892a7de62cd9ec582a06 +size 2 diff --git a/LibreOJ/3994/data/lock9.in b/LibreOJ/3994/data/lock9.in new file mode 100644 index 00000000..6255d6be --- /dev/null +++ b/LibreOJ/3994/data/lock9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbeff97e1b3620a27a0c27398e50a80522216261b8ad41ea949d40f67d1a90bc +size 52 diff --git a/LibreOJ/3994/samples/lock1.ans b/LibreOJ/3994/samples/lock1.ans new file mode 100644 index 00000000..1d0769d4 --- /dev/null +++ b/LibreOJ/3994/samples/lock1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce516e29a2ccfe4bab40e4e6adab7661cd695680482c00b1faa738fc0df62698 +size 3 diff --git a/LibreOJ/3994/samples/lock1.in b/LibreOJ/3994/samples/lock1.in new file mode 100644 index 00000000..4e350a54 --- /dev/null +++ b/LibreOJ/3994/samples/lock1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd845a30612361363943c5a8b3470f774015083dccf36f6ac03a67769a94af8f +size 12 diff --git a/LibreOJ/3994/samples/lock2.ans b/LibreOJ/3994/samples/lock2.ans new file mode 100644 index 00000000..f4808fee --- /dev/null +++ b/LibreOJ/3994/samples/lock2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:917df3320d778ddbaa5c5c7742bc4046bf803c36ed2b050f30844ed206783469 +size 3 diff --git a/LibreOJ/3994/samples/lock2.in b/LibreOJ/3994/samples/lock2.in new file mode 100644 index 00000000..440dd396 --- /dev/null +++ b/LibreOJ/3994/samples/lock2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46742ad4b960b07400c07ee5aa7d61b4bf7d006466e32ceec7d0b13fdc6305e1 +size 22