From 8b92825accaad6c8147e8e8c0b6ef44e8783e2c1 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Thu, 22 Dec 2022 21:37:33 +0800 Subject: [PATCH] =?UTF-8?q?1087.=20[SCOI2005]=E4=BA=92=E4=B8=8D=E4=BE=B5?= =?UTF-8?q?=E7=8A=AFKing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://hydro.ac/d/bzoj/record/63a45d95cf75a716a167379a --- BZOJ/1087/1087.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++ BZOJ/1087/data/1.in | 3 +++ BZOJ/1087/data/1.out | 3 +++ BZOJ/1087/data/10.in | 3 +++ BZOJ/1087/data/10.out | 3 +++ BZOJ/1087/data/2.in | 3 +++ BZOJ/1087/data/2.out | 3 +++ BZOJ/1087/data/3.in | 3 +++ BZOJ/1087/data/3.out | 3 +++ BZOJ/1087/data/4.in | 3 +++ BZOJ/1087/data/4.out | 3 +++ BZOJ/1087/data/5.in | 3 +++ BZOJ/1087/data/5.out | 3 +++ BZOJ/1087/data/6.in | 3 +++ BZOJ/1087/data/6.out | 3 +++ BZOJ/1087/data/7.in | 3 +++ BZOJ/1087/data/7.out | 3 +++ BZOJ/1087/data/8.in | 3 +++ BZOJ/1087/data/8.out | 3 +++ BZOJ/1087/data/9.in | 3 +++ BZOJ/1087/data/9.out | 3 +++ 21 files changed, 108 insertions(+) create mode 100644 BZOJ/1087/1087.cpp create mode 100644 BZOJ/1087/data/1.in create mode 100644 BZOJ/1087/data/1.out create mode 100644 BZOJ/1087/data/10.in create mode 100644 BZOJ/1087/data/10.out create mode 100644 BZOJ/1087/data/2.in create mode 100644 BZOJ/1087/data/2.out create mode 100644 BZOJ/1087/data/3.in create mode 100644 BZOJ/1087/data/3.out create mode 100644 BZOJ/1087/data/4.in create mode 100644 BZOJ/1087/data/4.out create mode 100644 BZOJ/1087/data/5.in create mode 100644 BZOJ/1087/data/5.out create mode 100644 BZOJ/1087/data/6.in create mode 100644 BZOJ/1087/data/6.out create mode 100644 BZOJ/1087/data/7.in create mode 100644 BZOJ/1087/data/7.out create mode 100644 BZOJ/1087/data/8.in create mode 100644 BZOJ/1087/data/8.out create mode 100644 BZOJ/1087/data/9.in create mode 100644 BZOJ/1087/data/9.out diff --git a/BZOJ/1087/1087.cpp b/BZOJ/1087/1087.cpp new file mode 100644 index 00000000..5194e32d --- /dev/null +++ b/BZOJ/1087/1087.cpp @@ -0,0 +1,48 @@ +#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/BZOJ/1087/data/1.in b/BZOJ/1087/data/1.in new file mode 100644 index 00000000..b4555149 --- /dev/null +++ b/BZOJ/1087/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb1135f17e81facd6ba91c9c27548eb003954f57acdfd8fac0a71ee5a1610ab1 +size 5 diff --git a/BZOJ/1087/data/1.out b/BZOJ/1087/data/1.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/BZOJ/1087/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/BZOJ/1087/data/10.in b/BZOJ/1087/data/10.in new file mode 100644 index 00000000..42dfc95b --- /dev/null +++ b/BZOJ/1087/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f6af77f0d0e9aa819a11c68c9cc6672de6fa0b5a4b4dc3ef98b2a495ec62cbf +size 5 diff --git a/BZOJ/1087/data/10.out b/BZOJ/1087/data/10.out new file mode 100644 index 00000000..9360a030 --- /dev/null +++ b/BZOJ/1087/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce59c4eb7a5d90ff4c3b63345ccdc8177ad79e9509f31bb74b2a01b920aeabdf +size 12 diff --git a/BZOJ/1087/data/2.in b/BZOJ/1087/data/2.in new file mode 100644 index 00000000..b94b46a9 --- /dev/null +++ b/BZOJ/1087/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa78e40a34b37d79e1d1ea2f2ddc5a7e13206a0d30d0c226a0d417b28e44a1ce +size 5 diff --git a/BZOJ/1087/data/2.out b/BZOJ/1087/data/2.out new file mode 100644 index 00000000..260a14d7 --- /dev/null +++ b/BZOJ/1087/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf1df3dc88594a0389d4ca24d75a74ee54aabc9d58329d284e024373b41cce88 +size 8 diff --git a/BZOJ/1087/data/3.in b/BZOJ/1087/data/3.in new file mode 100644 index 00000000..57d84b1a --- /dev/null +++ b/BZOJ/1087/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7463e54df91da56371e246c0ce49f246c987e5ca07afd4d51edcbc9c8f43ca4d +size 5 diff --git a/BZOJ/1087/data/3.out b/BZOJ/1087/data/3.out new file mode 100644 index 00000000..0f63ee94 --- /dev/null +++ b/BZOJ/1087/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ddef4f103668e7d5c8dda7bfd01a4cd4feb954e9b060c5c3529a8e3e9bd2ac8 +size 8 diff --git a/BZOJ/1087/data/4.in b/BZOJ/1087/data/4.in new file mode 100644 index 00000000..2407aea3 --- /dev/null +++ b/BZOJ/1087/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d774aa7655071c0c8e65f52bf6a4dbdf7629769ec767fb916ae9f8508211ad8d +size 4 diff --git a/BZOJ/1087/data/4.out b/BZOJ/1087/data/4.out new file mode 100644 index 00000000..9f4ac450 --- /dev/null +++ b/BZOJ/1087/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d8be10b3ed50cc658d676e141da61984e7ae711675bdf3a4c8278348d0a6c6b +size 6 diff --git a/BZOJ/1087/data/5.in b/BZOJ/1087/data/5.in new file mode 100644 index 00000000..8198d554 --- /dev/null +++ b/BZOJ/1087/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a4788aa38c41a27eb7736ddb2e46b912822ffcdec44aeb91ecedc28c662b4c4 +size 5 diff --git a/BZOJ/1087/data/5.out b/BZOJ/1087/data/5.out new file mode 100644 index 00000000..c23a5bac --- /dev/null +++ b/BZOJ/1087/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8696b08a4992019a836bf24f68ad7789d196193496ec9f3094f3ee0bdc1b8f13 +size 10 diff --git a/BZOJ/1087/data/6.in b/BZOJ/1087/data/6.in new file mode 100644 index 00000000..03164fc0 --- /dev/null +++ b/BZOJ/1087/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:813405789e1574e33f019c0188c424a295a898f35a1185031640367627bcc0ea +size 5 diff --git a/BZOJ/1087/data/6.out b/BZOJ/1087/data/6.out new file mode 100644 index 00000000..f9424ac0 --- /dev/null +++ b/BZOJ/1087/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96de8d2a0c86930412f63f77f01d7d570a77e293e71548321fd4a4bd46cd70d6 +size 12 diff --git a/BZOJ/1087/data/7.in b/BZOJ/1087/data/7.in new file mode 100644 index 00000000..d28bc50a --- /dev/null +++ b/BZOJ/1087/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ece3d232c1ca9ef8a80b6fdb1585b8f5cf653b9dd023b0521c8da64db859ffac +size 4 diff --git a/BZOJ/1087/data/7.out b/BZOJ/1087/data/7.out new file mode 100644 index 00000000..bf7021d6 --- /dev/null +++ b/BZOJ/1087/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6c21e8d260fe71882debdb339d2402a2ca7648529bc2303f48649bce0380017 +size 3 diff --git a/BZOJ/1087/data/8.in b/BZOJ/1087/data/8.in new file mode 100644 index 00000000..7d88d78b --- /dev/null +++ b/BZOJ/1087/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:501ddf83f5c6affb4bdc50a6a3f4feab9f41898825e236599893739a52e1196c +size 4 diff --git a/BZOJ/1087/data/8.out b/BZOJ/1087/data/8.out new file mode 100644 index 00000000..3c3743df --- /dev/null +++ b/BZOJ/1087/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29c0f6e8d498ee4552963cb2e4c743a2f0c81bd93c9e8dd0f25486a3289443b6 +size 5 diff --git a/BZOJ/1087/data/9.in b/BZOJ/1087/data/9.in new file mode 100644 index 00000000..71f4c5ac --- /dev/null +++ b/BZOJ/1087/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb54f1b8b2b5e5ab093f576b682ed59cc1ee3dc397f31f5209616ae155cc3471 +size 4 diff --git a/BZOJ/1087/data/9.out b/BZOJ/1087/data/9.out new file mode 100644 index 00000000..99630a52 --- /dev/null +++ b/BZOJ/1087/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6bd25bb864300af73419a3cc22cd69ba1fcd54f526f1a803144382bd4da5e3c +size 8