From 1ee825c5483cd6d55a0dd22527df8e6a4158905c Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Tue, 6 Sep 2022 16:59:40 +0800 Subject: [PATCH] =?UTF-8?q?1801.=20[Ahoi2009]chess=20=E4=B8=AD=E5=9B=BD?= =?UTF-8?q?=E8=B1=A1=E6=A3=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://hydro.ac/d/bzoj/record/63170bb13f0a183d28636b71 --- BZOJ/1801/1801.cpp | 87 +++++++++++++++++++++++++++++++++++++++++++ BZOJ/1801/data/1.in | 3 ++ BZOJ/1801/data/1.out | 3 ++ BZOJ/1801/data/10.in | 3 ++ BZOJ/1801/data/10.out | 3 ++ BZOJ/1801/data/2.in | 3 ++ BZOJ/1801/data/2.out | 3 ++ BZOJ/1801/data/3.in | 3 ++ BZOJ/1801/data/3.out | 3 ++ BZOJ/1801/data/4.in | 3 ++ BZOJ/1801/data/4.out | 3 ++ BZOJ/1801/data/5.in | 3 ++ BZOJ/1801/data/5.out | 3 ++ BZOJ/1801/data/6.in | 3 ++ BZOJ/1801/data/6.out | 3 ++ BZOJ/1801/data/7.in | 3 ++ BZOJ/1801/data/7.out | 3 ++ BZOJ/1801/data/8.in | 3 ++ BZOJ/1801/data/8.out | 3 ++ BZOJ/1801/data/9.in | 3 ++ BZOJ/1801/data/9.out | 3 ++ 21 files changed, 147 insertions(+) create mode 100644 BZOJ/1801/1801.cpp create mode 100644 BZOJ/1801/data/1.in create mode 100644 BZOJ/1801/data/1.out create mode 100644 BZOJ/1801/data/10.in create mode 100644 BZOJ/1801/data/10.out create mode 100644 BZOJ/1801/data/2.in create mode 100644 BZOJ/1801/data/2.out create mode 100644 BZOJ/1801/data/3.in create mode 100644 BZOJ/1801/data/3.out create mode 100644 BZOJ/1801/data/4.in create mode 100644 BZOJ/1801/data/4.out create mode 100644 BZOJ/1801/data/5.in create mode 100644 BZOJ/1801/data/5.out create mode 100644 BZOJ/1801/data/6.in create mode 100644 BZOJ/1801/data/6.out create mode 100644 BZOJ/1801/data/7.in create mode 100644 BZOJ/1801/data/7.out create mode 100644 BZOJ/1801/data/8.in create mode 100644 BZOJ/1801/data/8.out create mode 100644 BZOJ/1801/data/9.in create mode 100644 BZOJ/1801/data/9.out diff --git a/BZOJ/1801/1801.cpp b/BZOJ/1801/1801.cpp new file mode 100644 index 00000000..11cc1fd7 --- /dev/null +++ b/BZOJ/1801/1801.cpp @@ -0,0 +1,87 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 105; +const int mod = 9999973; + +int n, m; +long long f[N][N][N]{1}, ans; + +long long C(long long x) { + return x * (x - 1) / 2; +} + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n >> m; + + for (int i = 1; i <= n; i++) { + // 不增加炮 + for (int j = 0; j <= m; j++) { + for (int k = 0; j + k <= m; k++) { + f[i][j][k] = f[i - 1][j][k]; + } + } + + // 增加 1 个炮 + // + // 从 1 个炮增加到 2 个炮 + for (int j = 0; j <= m; j++) { + for (int k = 1; j + k <= m; k++) { + f[i][j][k] = (f[i][j][k] + f[i - 1][j + 1][k - 1] * (j + 1) % mod) % mod; + } + } + + // 增加 1 个炮 + // + // 从 0 个炮增加到 1 个炮 + for (int j = 1; j <= m; j++) { + for (int k = 0; j + k <= m; k++) { + f[i][j][k] = (f[i][j][k] + f[i - 1][j - 1][k] * (m - j - k + 1) % mod) % mod; + } + } + + // 增加 2 个炮 + // + // 一列从 0 个炮增加到 1 个炮 + // 一列从 1 个炮增加到 2 个炮 + for (int j = 0; j <= m; j++) { + for (int k = 1; j + k <= m; k++) { + f[i][j][k] = (f[i][j][k] + f[i - 1][j][k - 1] * j * (m - j - k + 1) % mod) % mod; + } + } + + // 增加 2 个炮 + // + // 两列从 0 个炮增加到 1 个炮 + for (int j = 2; j <= m; j++) { + for (int k = 0; j + k <= m; k++) { + f[i][j][k] = (f[i][j][k] + f[i - 1][j - 2][k] * C(m - j - k + 2) % mod) % mod; + } + } + + // 增加 2 个炮 + // + // 两列从 1 个炮增加到 2 个炮 + for (int j = 0; j <= m; j++) { + for (int k = 2; j + k <= m; k++) { + f[i][j][k] = (f[i][j][k] + f[i - 1][j + 2][k - 2] * C(j + 2) % mod) % mod; + } + } + } + + for (int i = 0; i <= m; i++) { + for (int j = 0; i + j <= m; j++) { + ans = (ans + f[n][i][j]) % mod; + } + } + + cout << ans << endl; + + return 0; +} diff --git a/BZOJ/1801/data/1.in b/BZOJ/1801/data/1.in new file mode 100644 index 00000000..aa9f0503 --- /dev/null +++ b/BZOJ/1801/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f2bbb6596fac0e3a9683e8412c862103a7c31244cae330a31ca602bc922e69a +size 4 diff --git a/BZOJ/1801/data/1.out b/BZOJ/1801/data/1.out new file mode 100644 index 00000000..85f92562 --- /dev/null +++ b/BZOJ/1801/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:809610430767a58f3409adcbf07cda0d91e3cafcb759c5b0df234ff08b2afa88 +size 5 diff --git a/BZOJ/1801/data/10.in b/BZOJ/1801/data/10.in new file mode 100644 index 00000000..218c36a2 --- /dev/null +++ b/BZOJ/1801/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c1f9534ed3f91538f3668f886aa4bb6d158dfdca7790b93fc2bd4f2c9ede944 +size 7 diff --git a/BZOJ/1801/data/10.out b/BZOJ/1801/data/10.out new file mode 100644 index 00000000..319397d4 --- /dev/null +++ b/BZOJ/1801/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3eb200a6c36daa6fd19bc2b7f927bb2fae786da2351bdc7b89ca20fb17d1132f +size 8 diff --git a/BZOJ/1801/data/2.in b/BZOJ/1801/data/2.in new file mode 100644 index 00000000..173da161 --- /dev/null +++ b/BZOJ/1801/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e043973d19fbcf1804353f8ebee95a97ea1f7c20e43206b6dede499c4c9cf35 +size 6 diff --git a/BZOJ/1801/data/2.out b/BZOJ/1801/data/2.out new file mode 100644 index 00000000..2de111aa --- /dev/null +++ b/BZOJ/1801/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97ab96c80638373b39a862e44c0ef907ec9b42dda46d8ba8a66a744c4a74d430 +size 8 diff --git a/BZOJ/1801/data/3.in b/BZOJ/1801/data/3.in new file mode 100644 index 00000000..90d9210b --- /dev/null +++ b/BZOJ/1801/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be002a51e218d8988a61577c4301b4dfeace6577f29f51e786af4ec44764c45c +size 6 diff --git a/BZOJ/1801/data/3.out b/BZOJ/1801/data/3.out new file mode 100644 index 00000000..861bd827 --- /dev/null +++ b/BZOJ/1801/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebf6242a91fb4f33b69d881cdc67df51b7de3f2252f410c7b836f9e7aa83a356 +size 8 diff --git a/BZOJ/1801/data/4.in b/BZOJ/1801/data/4.in new file mode 100644 index 00000000..38e03b3a --- /dev/null +++ b/BZOJ/1801/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6e73f1d5dd794893338e0f1fa03e676c58fbb5d35c7dae9aad9cc7e6426fa04 +size 5 diff --git a/BZOJ/1801/data/4.out b/BZOJ/1801/data/4.out new file mode 100644 index 00000000..a9d383e2 --- /dev/null +++ b/BZOJ/1801/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ead6f91b8f21f31ca755dd7c83073e9ef96b3baa6469c79908cc8b0c6fe355b8 +size 8 diff --git a/BZOJ/1801/data/5.in b/BZOJ/1801/data/5.in new file mode 100644 index 00000000..6dc78706 --- /dev/null +++ b/BZOJ/1801/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d63d0ac62176acc5977b66200ca95fbff99307c57a1cff0bc7d445ee1672dde +size 4 diff --git a/BZOJ/1801/data/5.out b/BZOJ/1801/data/5.out new file mode 100644 index 00000000..9d99ab73 --- /dev/null +++ b/BZOJ/1801/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bd7a6aff0538ab681c1de1e97c23cb00fab9b328a5e5a0bab20b42ade986bcf +size 6 diff --git a/BZOJ/1801/data/6.in b/BZOJ/1801/data/6.in new file mode 100644 index 00000000..98215dea --- /dev/null +++ b/BZOJ/1801/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9889d400e10c2d6df075a8766e3bd2df7e863ece46a422c56a11c81d0502c0f +size 6 diff --git a/BZOJ/1801/data/6.out b/BZOJ/1801/data/6.out new file mode 100644 index 00000000..461d68e4 --- /dev/null +++ b/BZOJ/1801/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6822474cf51557f66aef31cb6e1b5593c7839479a5a6592765ecb74e3c1eb747 +size 7 diff --git a/BZOJ/1801/data/7.in b/BZOJ/1801/data/7.in new file mode 100644 index 00000000..02e01985 --- /dev/null +++ b/BZOJ/1801/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c60b01e541166574a5e8da05c5b87d1b136907e6cb4b95b3ec70b1f679b56b1d +size 5 diff --git a/BZOJ/1801/data/7.out b/BZOJ/1801/data/7.out new file mode 100644 index 00000000..28a3e0f8 --- /dev/null +++ b/BZOJ/1801/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46a6c292acaf4f63480317388b13cc7851acb99c4626ebe0fa0619fb53bd71e8 +size 8 diff --git a/BZOJ/1801/data/8.in b/BZOJ/1801/data/8.in new file mode 100644 index 00000000..8684c3a3 --- /dev/null +++ b/BZOJ/1801/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8cb791422c3107cf5ada643a3a1dd1f00fd68c273c0965a54067a2ea1fc1d65a +size 6 diff --git a/BZOJ/1801/data/8.out b/BZOJ/1801/data/8.out new file mode 100644 index 00000000..9dda6001 --- /dev/null +++ b/BZOJ/1801/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60174dd2ea0c0708c6b216fdd0672d8e9dd97790eb5fcb07e0185cdfb1684940 +size 5 diff --git a/BZOJ/1801/data/9.in b/BZOJ/1801/data/9.in new file mode 100644 index 00000000..5083176b --- /dev/null +++ b/BZOJ/1801/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:930e86a94a98d9495a719f9785350a795c31b4aec671136ae4bb10896ab793bf +size 4 diff --git a/BZOJ/1801/data/9.out b/BZOJ/1801/data/9.out new file mode 100644 index 00000000..2d2edc08 --- /dev/null +++ b/BZOJ/1801/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1136bb1d8a4c0c3547c7eba65ae6a996c05726d5db98caf9bdb40129279ef0f +size 8