From 925330530c3f5ddedc5955fb45d89626e48d0b6b Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sat, 25 Feb 2023 20:21:46 +0800 Subject: [PATCH] =?UTF-8?q?#1972.=20=E3=80=90Public=20NOIP=20Round=20#5?= =?UTF-8?q?=E3=80=91=E9=9D=92=E9=B1=BC=E5=92=8C=E5=8C=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/72660 --- S2OJ/1972/1972.cpp | 46 +++++++++++++++++++++++++++++++++++ S2OJ/1972/data/interval1.ans | 3 +++ S2OJ/1972/data/interval1.in | 3 +++ S2OJ/1972/data/interval10.ans | 3 +++ S2OJ/1972/data/interval10.in | 3 +++ S2OJ/1972/data/interval2.ans | 3 +++ S2OJ/1972/data/interval2.in | 3 +++ S2OJ/1972/data/interval3.ans | 3 +++ S2OJ/1972/data/interval3.in | 3 +++ S2OJ/1972/data/interval4.ans | 3 +++ S2OJ/1972/data/interval4.in | 3 +++ S2OJ/1972/data/interval5.ans | 3 +++ S2OJ/1972/data/interval5.in | 3 +++ S2OJ/1972/data/interval6.ans | 3 +++ S2OJ/1972/data/interval6.in | 3 +++ S2OJ/1972/data/interval7.ans | 3 +++ S2OJ/1972/data/interval7.in | 3 +++ S2OJ/1972/data/interval8.ans | 3 +++ S2OJ/1972/data/interval8.in | 3 +++ S2OJ/1972/data/interval9.ans | 3 +++ S2OJ/1972/data/interval9.in | 3 +++ S2OJ/1972/data/problem.conf | 3 +++ 22 files changed, 109 insertions(+) create mode 100644 S2OJ/1972/1972.cpp create mode 100644 S2OJ/1972/data/interval1.ans create mode 100644 S2OJ/1972/data/interval1.in create mode 100644 S2OJ/1972/data/interval10.ans create mode 100644 S2OJ/1972/data/interval10.in create mode 100644 S2OJ/1972/data/interval2.ans create mode 100644 S2OJ/1972/data/interval2.in create mode 100644 S2OJ/1972/data/interval3.ans create mode 100644 S2OJ/1972/data/interval3.in create mode 100644 S2OJ/1972/data/interval4.ans create mode 100644 S2OJ/1972/data/interval4.in create mode 100644 S2OJ/1972/data/interval5.ans create mode 100644 S2OJ/1972/data/interval5.in create mode 100644 S2OJ/1972/data/interval6.ans create mode 100644 S2OJ/1972/data/interval6.in create mode 100644 S2OJ/1972/data/interval7.ans create mode 100644 S2OJ/1972/data/interval7.in create mode 100644 S2OJ/1972/data/interval8.ans create mode 100644 S2OJ/1972/data/interval8.in create mode 100644 S2OJ/1972/data/interval9.ans create mode 100644 S2OJ/1972/data/interval9.in create mode 100644 S2OJ/1972/data/problem.conf diff --git a/S2OJ/1972/1972.cpp b/S2OJ/1972/1972.cpp new file mode 100644 index 00000000..83bd1e06 --- /dev/null +++ b/S2OJ/1972/1972.cpp @@ -0,0 +1,46 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 305; + +int n, p, f[N][N], d[N], p2[N * N]; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n >> p; + + p2[0] = 1; + + for (int i = 1; i <= n * n; i++) { + p2[i] = static_cast(p2[i - 1]) * 2 % p; + } + + f[1][1] = 1; + + for (int i = 2; i <= n; i++) { + f[i][1] = p2[(i - 1) * (i - 2) / 2]; + + for (int j = 2; j <= i; j++) { + for (int k = 1; k < i; k++) { + f[i][j] = (f[i][j] + static_cast(f[k][j - 1]) * p2[(i - k - 1) * (i - k - 2) / 2] % p) % p; + } + } + } + + for (int i = 1; i <= n; i++) { + d[i] = p2[i * (i + 1) / 2]; + + for (int j = 1; j < i; j++) { + d[i] = ((d[i] - static_cast(f[i][j]) * d[j]) % p + p) % p; + } + } + + cout << d[n] << endl; + + return 0; +} diff --git a/S2OJ/1972/data/interval1.ans b/S2OJ/1972/data/interval1.ans new file mode 100644 index 00000000..2cdf955a --- /dev/null +++ b/S2OJ/1972/data/interval1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ab0a758a702af82cce4ea14a083e32952656c48a43fd5f44c2b8df22818cfa6 +size 6 diff --git a/S2OJ/1972/data/interval1.in b/S2OJ/1972/data/interval1.in new file mode 100644 index 00000000..26450dc1 --- /dev/null +++ b/S2OJ/1972/data/interval1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:117c4e5ac3773883d4672aa976f9f06181cde8e62c0660bb73dc605d2edd6e3b +size 12 diff --git a/S2OJ/1972/data/interval10.ans b/S2OJ/1972/data/interval10.ans new file mode 100644 index 00000000..c4697d05 --- /dev/null +++ b/S2OJ/1972/data/interval10.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ccfcf1a01399db3cc7bdac79c1ed38bed705b011d0839bec4dac77749390a556 +size 10 diff --git a/S2OJ/1972/data/interval10.in b/S2OJ/1972/data/interval10.in new file mode 100644 index 00000000..e9a0ea7f --- /dev/null +++ b/S2OJ/1972/data/interval10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47d5df5e9ae139f718b604b0acfcc8b6baa237da5fb0bfc70694be65fe5c3c1e +size 15 diff --git a/S2OJ/1972/data/interval2.ans b/S2OJ/1972/data/interval2.ans new file mode 100644 index 00000000..171d7ae9 --- /dev/null +++ b/S2OJ/1972/data/interval2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8df7a36e0296ae401ac308f7ca1525d4bfe9de2c6e249a49ef18270d47e6c373 +size 8 diff --git a/S2OJ/1972/data/interval2.in b/S2OJ/1972/data/interval2.in new file mode 100644 index 00000000..245ea14b --- /dev/null +++ b/S2OJ/1972/data/interval2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d797bec33bffca6f0851f59494befc1f22321aad86ca910e59c933e992380da1 +size 12 diff --git a/S2OJ/1972/data/interval3.ans b/S2OJ/1972/data/interval3.ans new file mode 100644 index 00000000..192683c3 --- /dev/null +++ b/S2OJ/1972/data/interval3.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:482d093e71dce81d78881b806edb59fac1e102bf1c9127b3d7fbcf2766e63813 +size 10 diff --git a/S2OJ/1972/data/interval3.in b/S2OJ/1972/data/interval3.in new file mode 100644 index 00000000..fe4cb14e --- /dev/null +++ b/S2OJ/1972/data/interval3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ed0bb8b6553089eb10bd6c7bae6416e2f0cc510934deb5cf63217dd2bd5bc7a +size 13 diff --git a/S2OJ/1972/data/interval4.ans b/S2OJ/1972/data/interval4.ans new file mode 100644 index 00000000..68718fdc --- /dev/null +++ b/S2OJ/1972/data/interval4.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a777137fccaec0e5f095fe5442dda8cf8f3cb48af0419d9f8f356e547a9d5d0 +size 10 diff --git a/S2OJ/1972/data/interval4.in b/S2OJ/1972/data/interval4.in new file mode 100644 index 00000000..51df8ec4 --- /dev/null +++ b/S2OJ/1972/data/interval4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4894e6bae239a94bdf04b999b06422e79cfe99d5bca06daf2ddf226a125f024 +size 13 diff --git a/S2OJ/1972/data/interval5.ans b/S2OJ/1972/data/interval5.ans new file mode 100644 index 00000000..581b804a --- /dev/null +++ b/S2OJ/1972/data/interval5.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27ad50802cebbdd989c3381114db50885230157e3d6591f387b99b242bed03d7 +size 9 diff --git a/S2OJ/1972/data/interval5.in b/S2OJ/1972/data/interval5.in new file mode 100644 index 00000000..5b97505f --- /dev/null +++ b/S2OJ/1972/data/interval5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4804ee076c0138c98fd903eafe776a3e7895f318f8773c1d1c50155f448dca1f +size 13 diff --git a/S2OJ/1972/data/interval6.ans b/S2OJ/1972/data/interval6.ans new file mode 100644 index 00000000..84bebc80 --- /dev/null +++ b/S2OJ/1972/data/interval6.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:487c5f19bd768cbb0abaa4cdbb2452949d6e5df493e43f0ecda5490b04e9148b +size 10 diff --git a/S2OJ/1972/data/interval6.in b/S2OJ/1972/data/interval6.in new file mode 100644 index 00000000..a4d6cfaf --- /dev/null +++ b/S2OJ/1972/data/interval6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee07dfa07225bd2b5ae9bfea6cd172d345413a443c8667131551b42244861a11 +size 13 diff --git a/S2OJ/1972/data/interval7.ans b/S2OJ/1972/data/interval7.ans new file mode 100644 index 00000000..f0f6541c --- /dev/null +++ b/S2OJ/1972/data/interval7.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a8efc6c2ab6159cef5a0b66f37a02186fa81b6b70bf2098527184834abc2e0f +size 10 diff --git a/S2OJ/1972/data/interval7.in b/S2OJ/1972/data/interval7.in new file mode 100644 index 00000000..bcc2c055 --- /dev/null +++ b/S2OJ/1972/data/interval7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7dec6c98b0e26687346af137953d96b91a82313872da69458ea9109c5249ed5 +size 14 diff --git a/S2OJ/1972/data/interval8.ans b/S2OJ/1972/data/interval8.ans new file mode 100644 index 00000000..76ae61a1 --- /dev/null +++ b/S2OJ/1972/data/interval8.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0f74ebb745919df5225d918a4da3c3fddd41abe98bea135e473e4873caed045 +size 10 diff --git a/S2OJ/1972/data/interval8.in b/S2OJ/1972/data/interval8.in new file mode 100644 index 00000000..004d13f9 --- /dev/null +++ b/S2OJ/1972/data/interval8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9acd31736771651aff0b6f6bb4bb90f75beb5165c9e2ba85b58d5369f49a3ba0 +size 14 diff --git a/S2OJ/1972/data/interval9.ans b/S2OJ/1972/data/interval9.ans new file mode 100644 index 00000000..3c60d410 --- /dev/null +++ b/S2OJ/1972/data/interval9.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b628ea683b6bbca97baf0cec9ab93a06a8a8c302189bed200cbaf8faf3503f3e +size 10 diff --git a/S2OJ/1972/data/interval9.in b/S2OJ/1972/data/interval9.in new file mode 100644 index 00000000..084b54a1 --- /dev/null +++ b/S2OJ/1972/data/interval9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:772f2a2ca580eeffcb7363a77f76cde6f5fa5ec155fec87cdb2983be4abc33f2 +size 14 diff --git a/S2OJ/1972/data/problem.conf b/S2OJ/1972/data/problem.conf new file mode 100644 index 00000000..a1e2d69f --- /dev/null +++ b/S2OJ/1972/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bacd8f04c5de7b45fd0b91d3de5301ffaeb77636d48c698db8869003405fec0a +size 191