From 577fe26b557a9a2a7ff9801d4f3f46b94f4532e2 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 30 May 2022 19:14:41 +0800 Subject: [PATCH] =?UTF-8?q?#10171.=20=E3=80=8C=E4=B8=80=E6=9C=AC=E9=80=9A?= =?UTF-8?q?=205.4=20=E4=BE=8B=202=E3=80=8D=E7=89=A7=E5=9C=BA=E7=9A=84?= =?UTF-8?q?=E5=AE=89=E6=8E=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://loj.ac/s/1472551 --- LibreOJ/10171/10171.cpp | 57 +++++++++++++++++++++++++++++++ LibreOJ/10171/data/cowfood.1.in | 3 ++ LibreOJ/10171/data/cowfood.1.out | 3 ++ LibreOJ/10171/data/cowfood.10.in | 3 ++ LibreOJ/10171/data/cowfood.10.out | 3 ++ LibreOJ/10171/data/cowfood.2.in | 3 ++ LibreOJ/10171/data/cowfood.2.out | 3 ++ LibreOJ/10171/data/cowfood.3.in | 3 ++ LibreOJ/10171/data/cowfood.3.out | 3 ++ LibreOJ/10171/data/cowfood.4.in | 3 ++ LibreOJ/10171/data/cowfood.4.out | 3 ++ LibreOJ/10171/data/cowfood.5.in | 3 ++ LibreOJ/10171/data/cowfood.5.out | 3 ++ LibreOJ/10171/data/cowfood.6.in | 3 ++ LibreOJ/10171/data/cowfood.6.out | 3 ++ LibreOJ/10171/data/cowfood.7.in | 3 ++ LibreOJ/10171/data/cowfood.7.out | 3 ++ LibreOJ/10171/data/cowfood.8.in | 3 ++ LibreOJ/10171/data/cowfood.8.out | 3 ++ LibreOJ/10171/data/cowfood.9.in | 3 ++ LibreOJ/10171/data/cowfood.9.out | 3 ++ LibreOJ/10171/data/cowfood.in | 3 ++ LibreOJ/10171/data/cowfood.out | 3 ++ 23 files changed, 123 insertions(+) create mode 100644 LibreOJ/10171/10171.cpp create mode 100644 LibreOJ/10171/data/cowfood.1.in create mode 100644 LibreOJ/10171/data/cowfood.1.out create mode 100644 LibreOJ/10171/data/cowfood.10.in create mode 100644 LibreOJ/10171/data/cowfood.10.out create mode 100644 LibreOJ/10171/data/cowfood.2.in create mode 100644 LibreOJ/10171/data/cowfood.2.out create mode 100644 LibreOJ/10171/data/cowfood.3.in create mode 100644 LibreOJ/10171/data/cowfood.3.out create mode 100644 LibreOJ/10171/data/cowfood.4.in create mode 100644 LibreOJ/10171/data/cowfood.4.out create mode 100644 LibreOJ/10171/data/cowfood.5.in create mode 100644 LibreOJ/10171/data/cowfood.5.out create mode 100644 LibreOJ/10171/data/cowfood.6.in create mode 100644 LibreOJ/10171/data/cowfood.6.out create mode 100644 LibreOJ/10171/data/cowfood.7.in create mode 100644 LibreOJ/10171/data/cowfood.7.out create mode 100644 LibreOJ/10171/data/cowfood.8.in create mode 100644 LibreOJ/10171/data/cowfood.8.out create mode 100644 LibreOJ/10171/data/cowfood.9.in create mode 100644 LibreOJ/10171/data/cowfood.9.out create mode 100644 LibreOJ/10171/data/cowfood.in create mode 100644 LibreOJ/10171/data/cowfood.out diff --git a/LibreOJ/10171/10171.cpp b/LibreOJ/10171/10171.cpp new file mode 100644 index 00000000..2bdf9c76 --- /dev/null +++ b/LibreOJ/10171/10171.cpp @@ -0,0 +1,57 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 15, + M = 0xfff + 5; // = (11111111111)2 + 5 +const int mod = 1e8; + +int m, n, a[N], f[N][M], ans; +bool s[M]; + +int main() { + std::ios::sync_with_stdio(false); + + cin >> m >> n; + + for (int i = 1; i <= m; i++) { + for (int j = 1, x; j <= n; j++) { + cin >> x; + a[i] <<= 1; + a[i] += x; + } + } + + for (int i = 0; i < 0xfff; i++) { + // 行内不存在相邻的草地 + if (!((i << 1) & i) && !((i >> 1) & i)) { + s[i] = true; + } + } + + f[0][0] = 1; + for (int i = 1; i <= m; i++) { + // 当前行的状态 + for (int j = 0; j < 0xfff; j++) { + // j 是合法的状态,且没有草被种在贫瘠的土地上 + if (s[j] && (a[i] & j) == j) { + // 枚举上一行的状态 + for (int k = 0; k < 0xfff; k++) { + if (!(k & j)) { // k 和 j 间不存在相邻的土地 + f[i][j] = (f[i][j] + f[i - 1][k]) % mod; + } + } + } + } + } + + for (int i = 0; i < 0xfff; i++) { + ans = (ans + f[m][i]) % mod; + } + + cout << ans << endl; + + return 0; +} diff --git a/LibreOJ/10171/data/cowfood.1.in b/LibreOJ/10171/data/cowfood.1.in new file mode 100644 index 00000000..d33b39aa --- /dev/null +++ b/LibreOJ/10171/data/cowfood.1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e78bb4193830e95343e0c948dbad1aa56f58b523639e810b67e4faa673a5186 +size 19 diff --git a/LibreOJ/10171/data/cowfood.1.out b/LibreOJ/10171/data/cowfood.1.out new file mode 100644 index 00000000..d790bd49 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e6d31a5983a91251bfae5aefa1c0a19d8ba3cf601d0e8a706b4cfa9661a6b8a +size 2 diff --git a/LibreOJ/10171/data/cowfood.10.in b/LibreOJ/10171/data/cowfood.10.in new file mode 100644 index 00000000..2cfdba14 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8922b433e0c58a18fd99ba5f4bacbb3f5247560eb2c203e7855cb8fa9027f20 +size 85 diff --git a/LibreOJ/10171/data/cowfood.10.out b/LibreOJ/10171/data/cowfood.10.out new file mode 100644 index 00000000..e79ddfe0 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7feeb2b8a3e555bf0f785670b59335e67ab014c9cd077bdc183fe765e33b51fb +size 8 diff --git a/LibreOJ/10171/data/cowfood.2.in b/LibreOJ/10171/data/cowfood.2.in new file mode 100644 index 00000000..503905f0 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07e7bb7382f7ac8b8a679977251db73be6eccf8d6ac23363abd672bf5500156e +size 36 diff --git a/LibreOJ/10171/data/cowfood.2.out b/LibreOJ/10171/data/cowfood.2.out new file mode 100644 index 00000000..c5a137e9 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85a0e6eb5530a682fa88345a5e7a144248f49e5b71b3eb587a9db5cd2957495a +size 4 diff --git a/LibreOJ/10171/data/cowfood.3.in b/LibreOJ/10171/data/cowfood.3.in new file mode 100644 index 00000000..09205486 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf00f7c3cdde6edc22d7709bfb5e9861310c129eca22db4a6f68d013e22953dd +size 25 diff --git a/LibreOJ/10171/data/cowfood.3.out b/LibreOJ/10171/data/cowfood.3.out new file mode 100644 index 00000000..ef83284b --- /dev/null +++ b/LibreOJ/10171/data/cowfood.3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9efe5a55840d37eb5db13a22ccab7e8f9867c982d1f7d18313c63fa0aa1c801b +size 4 diff --git a/LibreOJ/10171/data/cowfood.4.in b/LibreOJ/10171/data/cowfood.4.in new file mode 100644 index 00000000..4c3bc97c --- /dev/null +++ b/LibreOJ/10171/data/cowfood.4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:908516a06a4532ef8c3708d1fb614131df17df5acd9dc1821abf7bb3b533af43 +size 6 diff --git a/LibreOJ/10171/data/cowfood.4.out b/LibreOJ/10171/data/cowfood.4.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/LibreOJ/10171/data/cowfood.5.in b/LibreOJ/10171/data/cowfood.5.in new file mode 100644 index 00000000..1757a7b8 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d1abfa41178a8e19636033a1d75b478859c96db268ee51cea3223e18bd8281a +size 64 diff --git a/LibreOJ/10171/data/cowfood.5.out b/LibreOJ/10171/data/cowfood.5.out new file mode 100644 index 00000000..524c7397 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84e836ee47ca37d2dd6ab579dc0f04992bf2b3981c63f5cad85ed605614a218e +size 6 diff --git a/LibreOJ/10171/data/cowfood.6.in b/LibreOJ/10171/data/cowfood.6.in new file mode 100644 index 00000000..53354b9b --- /dev/null +++ b/LibreOJ/10171/data/cowfood.6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b701428615b8de92068ea1fa11268d162a517182451ae943911e54eb30eeaf05 +size 76 diff --git a/LibreOJ/10171/data/cowfood.6.out b/LibreOJ/10171/data/cowfood.6.out new file mode 100644 index 00000000..d6456893 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:921cab4dd8bd56be04bea95b10a9d25eaeade78e2c888f18e721499bddcf8d71 +size 7 diff --git a/LibreOJ/10171/data/cowfood.7.in b/LibreOJ/10171/data/cowfood.7.in new file mode 100644 index 00000000..6e95d1c5 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b313af3f0e85981ca00d9825f61400f3323a06e603825241d3604faf7e5cb51e +size 77 diff --git a/LibreOJ/10171/data/cowfood.7.out b/LibreOJ/10171/data/cowfood.7.out new file mode 100644 index 00000000..28a89d1a --- /dev/null +++ b/LibreOJ/10171/data/cowfood.7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be73e5778df50baf4779970cbec07012dea6aa2641677591fdf0c7054be75688 +size 7 diff --git a/LibreOJ/10171/data/cowfood.8.in b/LibreOJ/10171/data/cowfood.8.in new file mode 100644 index 00000000..a7cfac52 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa05969c9f269be5a6f04b14a6e3030c434847ca98e9fd41b7f94ecd680a15dc +size 148 diff --git a/LibreOJ/10171/data/cowfood.8.out b/LibreOJ/10171/data/cowfood.8.out new file mode 100644 index 00000000..93565773 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1334eb441f1365d8e2601419c7637ddb4e96640d2a942a97f793f82b58901a5 +size 9 diff --git a/LibreOJ/10171/data/cowfood.9.in b/LibreOJ/10171/data/cowfood.9.in new file mode 100644 index 00000000..9c33873a --- /dev/null +++ b/LibreOJ/10171/data/cowfood.9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38b77d489fa5676f33d41ba1b4804951b953f7f3a925f98cf9ea6ec17f38f5a6 +size 132 diff --git a/LibreOJ/10171/data/cowfood.9.out b/LibreOJ/10171/data/cowfood.9.out new file mode 100644 index 00000000..3b497299 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74b12f26118525f00de1e0bf753c50719bb3d17ce85be2ea1871040faf68e833 +size 9 diff --git a/LibreOJ/10171/data/cowfood.in b/LibreOJ/10171/data/cowfood.in new file mode 100644 index 00000000..9c33873a --- /dev/null +++ b/LibreOJ/10171/data/cowfood.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38b77d489fa5676f33d41ba1b4804951b953f7f3a925f98cf9ea6ec17f38f5a6 +size 132 diff --git a/LibreOJ/10171/data/cowfood.out b/LibreOJ/10171/data/cowfood.out new file mode 100644 index 00000000..7249b5a8 --- /dev/null +++ b/LibreOJ/10171/data/cowfood.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8898ba821b7b2636ac09a8db492e6d5f6b6a4b5f9c94ae27459292752705e3e +size 10