From 02872e62a03dcb351fc86c33ea683ba4c84b960e Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Tue, 31 May 2022 11:01:13 +0800 Subject: [PATCH] =?UTF-8?q?#10170.=20=E3=80=8C=E4=B8=80=E6=9C=AC=E9=80=9A?= =?UTF-8?q?=205.4=20=E4=BE=8B=201=E3=80=8D=E5=9B=BD=E7=8E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://loj.ac/s/1472785 --- LibreOJ/10170/10170.cpp | 50 ++++++++++++++++++++++++++++++++++ LibreOJ/10170/data/horse0.in | 3 ++ LibreOJ/10170/data/horse0.out | 3 ++ LibreOJ/10170/data/horse1.in | 3 ++ LibreOJ/10170/data/horse1.out | 3 ++ LibreOJ/10170/data/horse10.in | 3 ++ LibreOJ/10170/data/horse10.out | 3 ++ LibreOJ/10170/data/horse2.in | 3 ++ LibreOJ/10170/data/horse2.out | 3 ++ LibreOJ/10170/data/horse3.in | 3 ++ LibreOJ/10170/data/horse3.out | 3 ++ LibreOJ/10170/data/horse4.in | 3 ++ LibreOJ/10170/data/horse4.out | 3 ++ LibreOJ/10170/data/horse5.in | 3 ++ LibreOJ/10170/data/horse5.out | 3 ++ LibreOJ/10170/data/horse6.in | 3 ++ LibreOJ/10170/data/horse6.out | 3 ++ LibreOJ/10170/data/horse7.in | 3 ++ LibreOJ/10170/data/horse7.out | 3 ++ LibreOJ/10170/data/horse8.in | 3 ++ LibreOJ/10170/data/horse8.out | 3 ++ LibreOJ/10170/data/horse9.in | 3 ++ LibreOJ/10170/data/horse9.out | 3 ++ 23 files changed, 116 insertions(+) create mode 100644 LibreOJ/10170/10170.cpp create mode 100644 LibreOJ/10170/data/horse0.in create mode 100644 LibreOJ/10170/data/horse0.out create mode 100644 LibreOJ/10170/data/horse1.in create mode 100644 LibreOJ/10170/data/horse1.out create mode 100644 LibreOJ/10170/data/horse10.in create mode 100644 LibreOJ/10170/data/horse10.out create mode 100644 LibreOJ/10170/data/horse2.in create mode 100644 LibreOJ/10170/data/horse2.out create mode 100644 LibreOJ/10170/data/horse3.in create mode 100644 LibreOJ/10170/data/horse3.out create mode 100644 LibreOJ/10170/data/horse4.in create mode 100644 LibreOJ/10170/data/horse4.out create mode 100644 LibreOJ/10170/data/horse5.in create mode 100644 LibreOJ/10170/data/horse5.out create mode 100644 LibreOJ/10170/data/horse6.in create mode 100644 LibreOJ/10170/data/horse6.out create mode 100644 LibreOJ/10170/data/horse7.in create mode 100644 LibreOJ/10170/data/horse7.out create mode 100644 LibreOJ/10170/data/horse8.in create mode 100644 LibreOJ/10170/data/horse8.out create mode 100644 LibreOJ/10170/data/horse9.in create mode 100644 LibreOJ/10170/data/horse9.out diff --git a/LibreOJ/10170/10170.cpp b/LibreOJ/10170/10170.cpp new file mode 100644 index 00000000..e09d3d1d --- /dev/null +++ b/LibreOJ/10170/10170.cpp @@ -0,0 +1,50 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +int n, k; +int cnt, r[2005], s[2005]; +long long f[15][2005][105], ans; + +void dfs(int x, int sum, int len) { + if (len >= n) { + r[++cnt] = x; + s[cnt] = sum; + + return; + } + + dfs(x, sum, len + 1); + dfs(x + (1 << len), sum + 1, len + 2); +} + +int main() { + std::ios::sync_with_stdio(false); + + cin >> n >> k; + + dfs(0, 0, 0); + + for (int i = 1; i <= cnt; i++) f[1][i][s[i]] = 1; + + for (int i = 2; i <= n; i++) { + for (int j = 1; j <= cnt; j++) { + for (int p = 1; p <= cnt; p++) { + if ((r[j] & r[p]) || ((r[j] << 1) & r[p]) || (r[j] & (r[p] << 1))) continue; + + for (int l = k; l >= s[j]; l--) { + f[i][j][l] += f[i - 1][p][l - s[j]]; + } + } + } + } + + for (int i = 1; i <= cnt; i++) ans += f[n][i][k]; + + cout << ans << endl; + + return 0; +} diff --git a/LibreOJ/10170/data/horse0.in b/LibreOJ/10170/data/horse0.in new file mode 100644 index 00000000..a41004df --- /dev/null +++ b/LibreOJ/10170/data/horse0.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad0b817582db0df0dc48f0aa9bf10e508fcf6109a0e51c4ecb9783ecf97578c5 +size 6 diff --git a/LibreOJ/10170/data/horse0.out b/LibreOJ/10170/data/horse0.out new file mode 100644 index 00000000..9b23e792 --- /dev/null +++ b/LibreOJ/10170/data/horse0.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13bf7b3039c63bf5a50491fa3cfd8eb4e699d1ba1436315aef9cbe5711530354 +size 3 diff --git a/LibreOJ/10170/data/horse1.in b/LibreOJ/10170/data/horse1.in new file mode 100644 index 00000000..d28bc50a --- /dev/null +++ b/LibreOJ/10170/data/horse1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ece3d232c1ca9ef8a80b6fdb1585b8f5cf653b9dd023b0521c8da64db859ffac +size 4 diff --git a/LibreOJ/10170/data/horse1.out b/LibreOJ/10170/data/horse1.out new file mode 100644 index 00000000..a4d51d64 --- /dev/null +++ b/LibreOJ/10170/data/horse1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7a33ec2d3fa6748259d5a72ed976b7308fa7355fd99818bc0dc12fece595277 +size 4 diff --git a/LibreOJ/10170/data/horse10.in b/LibreOJ/10170/data/horse10.in new file mode 100644 index 00000000..32167554 --- /dev/null +++ b/LibreOJ/10170/data/horse10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6767d5f988fc2165a5d987988f42011e21322be30147e250bad9bf0aac53f25b +size 6 diff --git a/LibreOJ/10170/data/horse10.out b/LibreOJ/10170/data/horse10.out new file mode 100644 index 00000000..00947e53 --- /dev/null +++ b/LibreOJ/10170/data/horse10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dfaf0923f504172eca930c88e45510fefc7e1a0355136c818c3a7b2038233d0a +size 14 diff --git a/LibreOJ/10170/data/horse2.in b/LibreOJ/10170/data/horse2.in new file mode 100644 index 00000000..f5b24c37 --- /dev/null +++ b/LibreOJ/10170/data/horse2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c74ca9fbdc8f2a3d035d2dabe6e476e33e61bb7741f94b8c4d947186c36d866f +size 4 diff --git a/LibreOJ/10170/data/horse2.out b/LibreOJ/10170/data/horse2.out new file mode 100644 index 00000000..fdacc183 --- /dev/null +++ b/LibreOJ/10170/data/horse2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60dae80579a054bc5a7703da02947ee145e19400d113054f3af8e654b1b1713f +size 4 diff --git a/LibreOJ/10170/data/horse3.in b/LibreOJ/10170/data/horse3.in new file mode 100644 index 00000000..a879da29 --- /dev/null +++ b/LibreOJ/10170/data/horse3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:710be522d9548d4fada099b9516bd6e79e419558a0f84e9d3486b9f83876afd4 +size 4 diff --git a/LibreOJ/10170/data/horse3.out b/LibreOJ/10170/data/horse3.out new file mode 100644 index 00000000..87b6e521 --- /dev/null +++ b/LibreOJ/10170/data/horse3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0146781e17f0fa48bb5d90c02deccef5f6c90f712987e7d2dec2f4ed613020e +size 11 diff --git a/LibreOJ/10170/data/horse4.in b/LibreOJ/10170/data/horse4.in new file mode 100644 index 00000000..5083176b --- /dev/null +++ b/LibreOJ/10170/data/horse4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:930e86a94a98d9495a719f9785350a795c31b4aec671136ae4bb10896ab793bf +size 4 diff --git a/LibreOJ/10170/data/horse4.out b/LibreOJ/10170/data/horse4.out new file mode 100644 index 00000000..ea451896 --- /dev/null +++ b/LibreOJ/10170/data/horse4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f61db4c6ed60883ddbf0508de093190bda5ace5bd061c2f7b4632fa16f90646 +size 7 diff --git a/LibreOJ/10170/data/horse5.in b/LibreOJ/10170/data/horse5.in new file mode 100644 index 00000000..cd29a611 --- /dev/null +++ b/LibreOJ/10170/data/horse5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:673958e6cd9bcd6ed191d77bcaa87223c41caf877c028ce43e62a4670b5e14e5 +size 4 diff --git a/LibreOJ/10170/data/horse5.out b/LibreOJ/10170/data/horse5.out new file mode 100644 index 00000000..daae58be --- /dev/null +++ b/LibreOJ/10170/data/horse5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3688ad535820715d234ac693466713e065f1822c93c3889536b24a6479ca3ad5 +size 7 diff --git a/LibreOJ/10170/data/horse6.in b/LibreOJ/10170/data/horse6.in new file mode 100644 index 00000000..3844af38 --- /dev/null +++ b/LibreOJ/10170/data/horse6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a37e09b18e591fb23f0f297f7c879fab4bb5fa22d3c2dda9a83149ea58dfd50e +size 5 diff --git a/LibreOJ/10170/data/horse6.out b/LibreOJ/10170/data/horse6.out new file mode 100644 index 00000000..a2c2245d --- /dev/null +++ b/LibreOJ/10170/data/horse6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:354c21b16e34cc308cfb82451e2d2b3c56bdd08bdea5b674688824127a0d997a +size 11 diff --git a/LibreOJ/10170/data/horse7.in b/LibreOJ/10170/data/horse7.in new file mode 100644 index 00000000..8a3ea238 --- /dev/null +++ b/LibreOJ/10170/data/horse7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74def6278339a6381339a5866decda2f6900cb189db5d0852e43ecc9d047778d +size 5 diff --git a/LibreOJ/10170/data/horse7.out b/LibreOJ/10170/data/horse7.out new file mode 100644 index 00000000..05ba3a57 --- /dev/null +++ b/LibreOJ/10170/data/horse7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98b36e1406b6ca8e92303f032ab69ca8062020c15e9f033673049e8e7614622b +size 13 diff --git a/LibreOJ/10170/data/horse8.in b/LibreOJ/10170/data/horse8.in new file mode 100644 index 00000000..20bbf104 --- /dev/null +++ b/LibreOJ/10170/data/horse8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:160ac11cae4ff8e4cbe32f7a299e463c46e13c3b5e2d025f1a5e45aaf397c048 +size 5 diff --git a/LibreOJ/10170/data/horse8.out b/LibreOJ/10170/data/horse8.out new file mode 100644 index 00000000..9f3e0bb7 --- /dev/null +++ b/LibreOJ/10170/data/horse8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cfc765f7764760240d1cacb9a4249a1fdf0d0ed10b8326c72c8ecb61910b5ae3 +size 10 diff --git a/LibreOJ/10170/data/horse9.in b/LibreOJ/10170/data/horse9.in new file mode 100644 index 00000000..a1ccfae4 --- /dev/null +++ b/LibreOJ/10170/data/horse9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b3a3ad9552da324931fb27537e3151951d3641d00b8fb322de4a2b0580d353d +size 6 diff --git a/LibreOJ/10170/data/horse9.out b/LibreOJ/10170/data/horse9.out new file mode 100644 index 00000000..db0a5854 --- /dev/null +++ b/LibreOJ/10170/data/horse9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1bb7be4f47e846940a03f9934700af9a41fd11cd7e677fb3cbb09f949978ddd8 +size 15