From fc3ab0c801c5d8d5ae19c8876ca2ba180efe41ac Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 6 Feb 2023 18:15:10 +0800 Subject: [PATCH] =?UTF-8?q?4710.=20[Jsoi2011]=20=E5=88=86=E7=89=B9?= =?UTF-8?q?=E4=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://hydro.ac/d/bzoj/record/63e0d2d9dd8145683f793e11 --- BZOJ/4710/4710.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++ BZOJ/4710/data/1.in | 3 +++ BZOJ/4710/data/1.out | 3 +++ BZOJ/4710/data/10.in | 3 +++ BZOJ/4710/data/10.out | 3 +++ BZOJ/4710/data/2.in | 3 +++ BZOJ/4710/data/2.out | 3 +++ BZOJ/4710/data/3.in | 3 +++ BZOJ/4710/data/3.out | 3 +++ BZOJ/4710/data/4.in | 3 +++ BZOJ/4710/data/4.out | 3 +++ BZOJ/4710/data/5.in | 3 +++ BZOJ/4710/data/5.out | 3 +++ BZOJ/4710/data/6.in | 3 +++ BZOJ/4710/data/6.out | 3 +++ BZOJ/4710/data/7.in | 3 +++ BZOJ/4710/data/7.out | 3 +++ BZOJ/4710/data/8.in | 3 +++ BZOJ/4710/data/8.out | 3 +++ BZOJ/4710/data/9.in | 3 +++ BZOJ/4710/data/9.out | 3 +++ 21 files changed, 113 insertions(+) create mode 100644 BZOJ/4710/4710.cpp create mode 100644 BZOJ/4710/data/1.in create mode 100644 BZOJ/4710/data/1.out create mode 100644 BZOJ/4710/data/10.in create mode 100644 BZOJ/4710/data/10.out create mode 100644 BZOJ/4710/data/2.in create mode 100644 BZOJ/4710/data/2.out create mode 100644 BZOJ/4710/data/3.in create mode 100644 BZOJ/4710/data/3.out create mode 100644 BZOJ/4710/data/4.in create mode 100644 BZOJ/4710/data/4.out create mode 100644 BZOJ/4710/data/5.in create mode 100644 BZOJ/4710/data/5.out create mode 100644 BZOJ/4710/data/6.in create mode 100644 BZOJ/4710/data/6.out create mode 100644 BZOJ/4710/data/7.in create mode 100644 BZOJ/4710/data/7.out create mode 100644 BZOJ/4710/data/8.in create mode 100644 BZOJ/4710/data/8.out create mode 100644 BZOJ/4710/data/9.in create mode 100644 BZOJ/4710/data/9.out diff --git a/BZOJ/4710/4710.cpp b/BZOJ/4710/4710.cpp new file mode 100644 index 00000000..c448136a --- /dev/null +++ b/BZOJ/4710/4710.cpp @@ -0,0 +1,53 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 2005; +const int mod = 1e9 + 7; + +int n, m, a[N], c[N][N], f[N], ans; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + c[0][0] = 1; + + for (int i = 1; i < N; ++i) { + c[i][0] = 1; + + for (int j = 1; j <= i; ++j) { + c[i][j] = (static_cast(c[i - 1][j - 1]) + c[i - 1][j]) % mod; + } + } + + cin >> n >> m; + + for (int i = 1; i <= m; i++) { + cin >> a[i]; + } + + for (int i = 0; i < n; i++) { + f[i] = 1; + + for (int j = 1; j <= m; j++) { + f[i] = static_cast(f[i]) * c[n - i + a[j] - 1][n - i - 1] % mod; + } + + f[i] = static_cast(f[i]) * c[n][i] % mod; + } + + for (int i = 0; i < n; i++) { + if (i % 2 == 0) { + ans = (static_cast(ans) + f[i]) % mod; + } else { + ans = (static_cast(ans) - f[i] + mod) % mod; + } + } + + cout << ans << endl; + + return 0; +} diff --git a/BZOJ/4710/data/1.in b/BZOJ/4710/data/1.in new file mode 100644 index 00000000..ae6a3dd7 --- /dev/null +++ b/BZOJ/4710/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:521626a96a0206fb32d65117983f0bfec42b92bd82a3728fae30150cf717cc39 +size 771 diff --git a/BZOJ/4710/data/1.out b/BZOJ/4710/data/1.out new file mode 100644 index 00000000..21b20138 --- /dev/null +++ b/BZOJ/4710/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a661499cb8e27555d9a77f610416f405e3c4cfc0c4e492b95bc41631fdfc32eb +size 10 diff --git a/BZOJ/4710/data/10.in b/BZOJ/4710/data/10.in new file mode 100644 index 00000000..df53c1ff --- /dev/null +++ b/BZOJ/4710/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8612a862983a44b90f1f05b9760b59028f5c52bb38e5d9434777c94cebdb0446 +size 3877 diff --git a/BZOJ/4710/data/10.out b/BZOJ/4710/data/10.out new file mode 100644 index 00000000..ab191d2c --- /dev/null +++ b/BZOJ/4710/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2add00c70113326afe3e36e83b973cd3c52cf319006498e2e0ebd66ddd09f1f9 +size 10 diff --git a/BZOJ/4710/data/2.in b/BZOJ/4710/data/2.in new file mode 100644 index 00000000..12c141e1 --- /dev/null +++ b/BZOJ/4710/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8bc081fd86f3dc231c4316c2ddaf4f89bf28229bd16f09522024e67000c8e14c +size 45 diff --git a/BZOJ/4710/data/2.out b/BZOJ/4710/data/2.out new file mode 100644 index 00000000..33658889 --- /dev/null +++ b/BZOJ/4710/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c7697610d471d72bd2516809754297b488b4db088dfedef02491a0d2f3b1975 +size 10 diff --git a/BZOJ/4710/data/3.in b/BZOJ/4710/data/3.in new file mode 100644 index 00000000..0ddb95ea --- /dev/null +++ b/BZOJ/4710/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c27052ff323bee81a51083494ee78ef487f8f54e9ade7a5f8ceee074f852fd44 +size 425 diff --git a/BZOJ/4710/data/3.out b/BZOJ/4710/data/3.out new file mode 100644 index 00000000..085557c2 --- /dev/null +++ b/BZOJ/4710/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ac30ead7998d2a1beb4dbfba82b3e5c5b5f17e840a375e2394c793a69170915 +size 10 diff --git a/BZOJ/4710/data/4.in b/BZOJ/4710/data/4.in new file mode 100644 index 00000000..1d603dfc --- /dev/null +++ b/BZOJ/4710/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6a2554455f6beae2b409f5aa1f984e690984b40821d2d6d25098d0c64a9b7bd +size 24 diff --git a/BZOJ/4710/data/4.out b/BZOJ/4710/data/4.out new file mode 100644 index 00000000..7e740be1 --- /dev/null +++ b/BZOJ/4710/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3540d8e7a800e033b9f951a86d4d38d170ec7fe84e0777684010fc143a201125 +size 10 diff --git a/BZOJ/4710/data/5.in b/BZOJ/4710/data/5.in new file mode 100644 index 00000000..56b15a1f --- /dev/null +++ b/BZOJ/4710/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82c206fbd738342008ae4aa258072f60b1707f1e8e33c73b57f860374ee2a1ee +size 115 diff --git a/BZOJ/4710/data/5.out b/BZOJ/4710/data/5.out new file mode 100644 index 00000000..1a76acfd --- /dev/null +++ b/BZOJ/4710/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c28b8bbafc01cc66bc10ad945f49fb2721969ccd5aaf76573ecf0126ccef115 +size 10 diff --git a/BZOJ/4710/data/6.in b/BZOJ/4710/data/6.in new file mode 100644 index 00000000..9bb1c784 --- /dev/null +++ b/BZOJ/4710/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2153286dd5bdff329f397358855ca9bbf2431ab7459becfd5f0c987881a20a8b +size 17 diff --git a/BZOJ/4710/data/6.out b/BZOJ/4710/data/6.out new file mode 100644 index 00000000..b1c0a225 --- /dev/null +++ b/BZOJ/4710/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f75414c8a0aeda4ac3590d24805340b6eb909dead7c7a2402ba94f99425bd53b +size 10 diff --git a/BZOJ/4710/data/7.in b/BZOJ/4710/data/7.in new file mode 100644 index 00000000..4db2f305 --- /dev/null +++ b/BZOJ/4710/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:975c06a3d79a244b2f46a7721e843be2b3f726ed2209ff7d82ae35d94dd08f6f +size 16 diff --git a/BZOJ/4710/data/7.out b/BZOJ/4710/data/7.out new file mode 100644 index 00000000..74be6090 --- /dev/null +++ b/BZOJ/4710/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:272321ca27d3cd6b6063d9664a4c7d5539443dcc043790ebcf56ed5ab8c3b660 +size 10 diff --git a/BZOJ/4710/data/8.in b/BZOJ/4710/data/8.in new file mode 100644 index 00000000..50e9c16b --- /dev/null +++ b/BZOJ/4710/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfbe90b10a76540d39a1bdd2743d1d766b2c44ef1b0eac8c85422de4b4539a65 +size 34 diff --git a/BZOJ/4710/data/8.out b/BZOJ/4710/data/8.out new file mode 100644 index 00000000..213bfc03 --- /dev/null +++ b/BZOJ/4710/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63571a98a850d3655a6f57ea420e21f7a366072e808a7e04ecc4fe4cd057528c +size 10 diff --git a/BZOJ/4710/data/9.in b/BZOJ/4710/data/9.in new file mode 100644 index 00000000..0b972b09 --- /dev/null +++ b/BZOJ/4710/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ae4dd9b7a2a173e329d4c0c99d32ea1fbbccae830cc9b8d559e77e09e7cb903 +size 29 diff --git a/BZOJ/4710/data/9.out b/BZOJ/4710/data/9.out new file mode 100644 index 00000000..f58dae41 --- /dev/null +++ b/BZOJ/4710/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66dadd6dd8838dbcd8f8a530c9dd5d68e5ab3b7172e57e60d2cc80c29c619357 +size 10