From e689335869aa1a38b33c6741a8df7c207fb6d0cb Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Tue, 8 Nov 2022 10:25:44 +0800 Subject: [PATCH] =?UTF-8?q?#1745.=20=E3=80=902022.11.8=20NOIP=20=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E8=B5=9B=E3=80=91=E7=9F=B3=E8=92=9C=E5=8F=8D=E5=86=B2?= =?UTF-8?q?=EF=BC=88lycoris=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/63909 --- S2OJ/1745/1745.cpp | 68 ++++++++++++++++++++++++++++++++++ S2OJ/1745/data/ex_lycoris1.in | 3 ++ S2OJ/1745/data/ex_lycoris1.out | 3 ++ S2OJ/1745/data/ex_lycoris2.in | 3 ++ S2OJ/1745/data/ex_lycoris2.out | 3 ++ S2OJ/1745/data/ex_lycoris3.in | 3 ++ S2OJ/1745/data/ex_lycoris3.out | 3 ++ S2OJ/1745/data/ex_lycoris4.in | 3 ++ S2OJ/1745/data/ex_lycoris4.out | 3 ++ S2OJ/1745/data/ex_lycoris5.in | 3 ++ S2OJ/1745/data/ex_lycoris5.out | 3 ++ S2OJ/1745/data/lycoris1.in | 3 ++ S2OJ/1745/data/lycoris1.out | 3 ++ S2OJ/1745/data/lycoris10.in | 3 ++ S2OJ/1745/data/lycoris10.out | 3 ++ S2OJ/1745/data/lycoris11.in | 3 ++ S2OJ/1745/data/lycoris11.out | 3 ++ S2OJ/1745/data/lycoris12.in | 3 ++ S2OJ/1745/data/lycoris12.out | 3 ++ S2OJ/1745/data/lycoris13.in | 3 ++ S2OJ/1745/data/lycoris13.out | 3 ++ S2OJ/1745/data/lycoris2.in | 3 ++ S2OJ/1745/data/lycoris2.out | 3 ++ S2OJ/1745/data/lycoris3.in | 3 ++ S2OJ/1745/data/lycoris3.out | 3 ++ S2OJ/1745/data/lycoris4.in | 3 ++ S2OJ/1745/data/lycoris4.out | 3 ++ S2OJ/1745/data/lycoris5.in | 3 ++ S2OJ/1745/data/lycoris5.out | 3 ++ S2OJ/1745/data/lycoris6.in | 3 ++ S2OJ/1745/data/lycoris6.out | 3 ++ S2OJ/1745/data/lycoris7.in | 3 ++ S2OJ/1745/data/lycoris7.out | 3 ++ S2OJ/1745/data/lycoris8.in | 3 ++ S2OJ/1745/data/lycoris8.out | 3 ++ S2OJ/1745/data/lycoris9.in | 3 ++ S2OJ/1745/data/lycoris9.out | 3 ++ S2OJ/1745/data/problem.conf | 3 ++ 38 files changed, 179 insertions(+) create mode 100644 S2OJ/1745/1745.cpp create mode 100644 S2OJ/1745/data/ex_lycoris1.in create mode 100644 S2OJ/1745/data/ex_lycoris1.out create mode 100644 S2OJ/1745/data/ex_lycoris2.in create mode 100644 S2OJ/1745/data/ex_lycoris2.out create mode 100644 S2OJ/1745/data/ex_lycoris3.in create mode 100644 S2OJ/1745/data/ex_lycoris3.out create mode 100644 S2OJ/1745/data/ex_lycoris4.in create mode 100644 S2OJ/1745/data/ex_lycoris4.out create mode 100644 S2OJ/1745/data/ex_lycoris5.in create mode 100644 S2OJ/1745/data/ex_lycoris5.out create mode 100644 S2OJ/1745/data/lycoris1.in create mode 100644 S2OJ/1745/data/lycoris1.out create mode 100644 S2OJ/1745/data/lycoris10.in create mode 100644 S2OJ/1745/data/lycoris10.out create mode 100644 S2OJ/1745/data/lycoris11.in create mode 100644 S2OJ/1745/data/lycoris11.out create mode 100644 S2OJ/1745/data/lycoris12.in create mode 100644 S2OJ/1745/data/lycoris12.out create mode 100644 S2OJ/1745/data/lycoris13.in create mode 100644 S2OJ/1745/data/lycoris13.out create mode 100644 S2OJ/1745/data/lycoris2.in create mode 100644 S2OJ/1745/data/lycoris2.out create mode 100644 S2OJ/1745/data/lycoris3.in create mode 100644 S2OJ/1745/data/lycoris3.out create mode 100644 S2OJ/1745/data/lycoris4.in create mode 100644 S2OJ/1745/data/lycoris4.out create mode 100644 S2OJ/1745/data/lycoris5.in create mode 100644 S2OJ/1745/data/lycoris5.out create mode 100644 S2OJ/1745/data/lycoris6.in create mode 100644 S2OJ/1745/data/lycoris6.out create mode 100644 S2OJ/1745/data/lycoris7.in create mode 100644 S2OJ/1745/data/lycoris7.out create mode 100644 S2OJ/1745/data/lycoris8.in create mode 100644 S2OJ/1745/data/lycoris8.out create mode 100644 S2OJ/1745/data/lycoris9.in create mode 100644 S2OJ/1745/data/lycoris9.out create mode 100644 S2OJ/1745/data/problem.conf diff --git a/S2OJ/1745/1745.cpp b/S2OJ/1745/1745.cpp new file mode 100644 index 00000000..53779231 --- /dev/null +++ b/S2OJ/1745/1745.cpp @@ -0,0 +1,68 @@ +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 10005, + K = 2005; +const int mod = 993244353; + +const std::string s1 = "sakana"; +const std::string s2 = "chinanago"; + +int n, k, _f[N][K], *f[N]; +std::string s; + +bool check(const std::string &pat, const std::string &str) { + if (pat.size() != str.size()) return false; + + for (int i = 0; i < pat.size(); i++) { + if (pat[i] != '?' && pat[i] != str[i]) return false; + } + + return true; +} + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n >> s; + + k = n / std::max(s1.size(), s2.size()); + s = ' ' + s; + + for (int i = 0; i <= n; i++) { + f[i] = _f[i] + k + 1; + } + + f[0][0] = 1; + + for (int i = 1; i <= n; i++) { + for (int j = -k; j <= k; j++) { + if (s[i] == '?') f[i][j] = (f[i][j] + static_cast(f[i - 1][j]) * 26 % mod) % mod; + else f[i][j] = f[i - 1][j]; + } + + if (i >= s1.size() && check(s.substr(i - s1.size() + 1, s1.size()), s1)) { + for (int j = -k; j <= k; j++) { + f[i][j] = ((f[i][j] - f[i - s1.size()][j]) % mod + mod) % mod; + f[i][j + 1] = (f[i][j + 1] + f[i - s1.size()][j]) % mod; + } + } + + if (i >= s2.size() && check(s.substr(i - s2.size() + 1, s2.size()), s2)) { + for (int j = -k; j <= k; j++) { + f[i][j] = ((f[i][j] - f[i - s2.size()][j]) % mod + mod) % mod; + f[i][j - 1] = (f[i][j - 1] + f[i - s2.size()][j]) % mod; + } + } + } + + cout << f[n][0] << endl; + + return 0; +} diff --git a/S2OJ/1745/data/ex_lycoris1.in b/S2OJ/1745/data/ex_lycoris1.in new file mode 100644 index 00000000..a3b5920b --- /dev/null +++ b/S2OJ/1745/data/ex_lycoris1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37aff9193550ca27b72f7ffa7a8891c814f2e4a093f680d236d710e01346e0cd +size 9 diff --git a/S2OJ/1745/data/ex_lycoris1.out b/S2OJ/1745/data/ex_lycoris1.out new file mode 100644 index 00000000..804fcc90 --- /dev/null +++ b/S2OJ/1745/data/ex_lycoris1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa +size 2 diff --git a/S2OJ/1745/data/ex_lycoris2.in b/S2OJ/1745/data/ex_lycoris2.in new file mode 100644 index 00000000..e3a87aeb --- /dev/null +++ b/S2OJ/1745/data/ex_lycoris2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d8778c9d97ffc2868b4b7ed0692700130b9dbde10d18fd935fed8e7bd9c20f1 +size 12 diff --git a/S2OJ/1745/data/ex_lycoris2.out b/S2OJ/1745/data/ex_lycoris2.out new file mode 100644 index 00000000..e1418f76 --- /dev/null +++ b/S2OJ/1745/data/ex_lycoris2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:64aeb9975f234becd55bb4635e6e2f2da7a6b7bf0a896f0c07763bdfbfb31420 +size 3 diff --git a/S2OJ/1745/data/ex_lycoris3.in b/S2OJ/1745/data/ex_lycoris3.in new file mode 100644 index 00000000..a6175c5b --- /dev/null +++ b/S2OJ/1745/data/ex_lycoris3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d996eb7f8829eade547f286795e3ba7897879aef27bc3bc5aa17e481347c49c +size 14 diff --git a/S2OJ/1745/data/ex_lycoris3.out b/S2OJ/1745/data/ex_lycoris3.out new file mode 100644 index 00000000..af48d99e --- /dev/null +++ b/S2OJ/1745/data/ex_lycoris3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32629b0effb1cc09f588c700c2dd6d47aca25a39261858333feadc8696174acf +size 10 diff --git a/S2OJ/1745/data/ex_lycoris4.in b/S2OJ/1745/data/ex_lycoris4.in new file mode 100644 index 00000000..5d4485cb --- /dev/null +++ b/S2OJ/1745/data/ex_lycoris4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa732dde61905e15a14e2d56ee216f5e1aafa3aa006e90718610ab515f8a062d +size 24 diff --git a/S2OJ/1745/data/ex_lycoris4.out b/S2OJ/1745/data/ex_lycoris4.out new file mode 100644 index 00000000..faf950a7 --- /dev/null +++ b/S2OJ/1745/data/ex_lycoris4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91c78212012090d5a64fbfa553e54ba16762a678c349290255b425627df3fd48 +size 10 diff --git a/S2OJ/1745/data/ex_lycoris5.in b/S2OJ/1745/data/ex_lycoris5.in new file mode 100644 index 00000000..4be956ae --- /dev/null +++ b/S2OJ/1745/data/ex_lycoris5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d292232794f3d66e90c5737386c74bf5fc2d5d69da86da53e22f87bbc235505c +size 1006 diff --git a/S2OJ/1745/data/ex_lycoris5.out b/S2OJ/1745/data/ex_lycoris5.out new file mode 100644 index 00000000..9754a2bf --- /dev/null +++ b/S2OJ/1745/data/ex_lycoris5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b05d382cf4f4d09007691a8eca486e370ce7c6ced2f17561e86d3d3af1dbadb +size 10 diff --git a/S2OJ/1745/data/lycoris1.in b/S2OJ/1745/data/lycoris1.in new file mode 100644 index 00000000..69f38943 --- /dev/null +++ b/S2OJ/1745/data/lycoris1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7ba74440ce10ef18a5e16c9f16e5fa28f0085a892a512e42a36f9a5cf936b02 +size 3007 diff --git a/S2OJ/1745/data/lycoris1.out b/S2OJ/1745/data/lycoris1.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/S2OJ/1745/data/lycoris1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/S2OJ/1745/data/lycoris10.in b/S2OJ/1745/data/lycoris10.in new file mode 100644 index 00000000..fcd2ec70 --- /dev/null +++ b/S2OJ/1745/data/lycoris10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52c31ff6e3d69a34d0c9dc5ab407c9c5d6e135fec366c7649934c3cbbf8b957a +size 9987 diff --git a/S2OJ/1745/data/lycoris10.out b/S2OJ/1745/data/lycoris10.out new file mode 100644 index 00000000..86c584d0 --- /dev/null +++ b/S2OJ/1745/data/lycoris10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:053366bd5cfcc9f3d2894b06d8fcd048e2ca1947f3048faf2504be943a356980 +size 10 diff --git a/S2OJ/1745/data/lycoris11.in b/S2OJ/1745/data/lycoris11.in new file mode 100644 index 00000000..abbd0b8c --- /dev/null +++ b/S2OJ/1745/data/lycoris11.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7090ff132dc23a34107994e4b62d04b51c7ed72f0fabd7cc18b71a9c423a1cd1 +size 10007 diff --git a/S2OJ/1745/data/lycoris11.out b/S2OJ/1745/data/lycoris11.out new file mode 100644 index 00000000..5fc0c52c --- /dev/null +++ b/S2OJ/1745/data/lycoris11.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e2277d7eb2fc726fced1aa5c126b82b9c278d6d2ba5f4c2aa1aadc0ceb4462d +size 10 diff --git a/S2OJ/1745/data/lycoris12.in b/S2OJ/1745/data/lycoris12.in new file mode 100644 index 00000000..906aeb10 --- /dev/null +++ b/S2OJ/1745/data/lycoris12.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e92d718afd839bda3d2bd94a9cf51bd9d025bf597541f92fd1edac89c429c38 +size 10007 diff --git a/S2OJ/1745/data/lycoris12.out b/S2OJ/1745/data/lycoris12.out new file mode 100644 index 00000000..0983a990 --- /dev/null +++ b/S2OJ/1745/data/lycoris12.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69db23d49b69cc07da8c5d405b0fb836f02fd5a3cd9ca09918b09ec21c92074d +size 10 diff --git a/S2OJ/1745/data/lycoris13.in b/S2OJ/1745/data/lycoris13.in new file mode 100644 index 00000000..f658f16e --- /dev/null +++ b/S2OJ/1745/data/lycoris13.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e6cbceabeba202dd85f04d55ac85571c0b12248696905fea2e3fe69cb308580 +size 10007 diff --git a/S2OJ/1745/data/lycoris13.out b/S2OJ/1745/data/lycoris13.out new file mode 100644 index 00000000..89784e61 --- /dev/null +++ b/S2OJ/1745/data/lycoris13.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:744354db36fce31cb841ce4a30073091c2410b77dc7b23d40bcc31617058b535 +size 10 diff --git a/S2OJ/1745/data/lycoris2.in b/S2OJ/1745/data/lycoris2.in new file mode 100644 index 00000000..d18032ea --- /dev/null +++ b/S2OJ/1745/data/lycoris2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1528253ea2e94b2a0b16ea73525ee52219e1dd01dcdace9c6cffbe08a776001c +size 3007 diff --git a/S2OJ/1745/data/lycoris2.out b/S2OJ/1745/data/lycoris2.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/S2OJ/1745/data/lycoris2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/S2OJ/1745/data/lycoris3.in b/S2OJ/1745/data/lycoris3.in new file mode 100644 index 00000000..a44caf03 --- /dev/null +++ b/S2OJ/1745/data/lycoris3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b750085c418833534027dbe3b9e1d3cd2bdf95ae36033f40a54e707cb619da8 +size 24 diff --git a/S2OJ/1745/data/lycoris3.out b/S2OJ/1745/data/lycoris3.out new file mode 100644 index 00000000..be556bd9 --- /dev/null +++ b/S2OJ/1745/data/lycoris3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:425afe6d1f95045fbadad9feba3fec01242dda4a0ad85ef46668d393688234b5 +size 9 diff --git a/S2OJ/1745/data/lycoris4.in b/S2OJ/1745/data/lycoris4.in new file mode 100644 index 00000000..cc4fc09b --- /dev/null +++ b/S2OJ/1745/data/lycoris4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7577f01659de1e3526356e75622cd12d635b7b03d582c397c4f834f2daf6e4dd +size 24 diff --git a/S2OJ/1745/data/lycoris4.out b/S2OJ/1745/data/lycoris4.out new file mode 100644 index 00000000..faeab470 --- /dev/null +++ b/S2OJ/1745/data/lycoris4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62ab99200741018ba13371926531dfe7d3408a0cd1c9d48696fed6af75629f43 +size 10 diff --git a/S2OJ/1745/data/lycoris5.in b/S2OJ/1745/data/lycoris5.in new file mode 100644 index 00000000..cef5cb15 --- /dev/null +++ b/S2OJ/1745/data/lycoris5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cebff10340d719f35572be521fbdd07faa2fd3b1881c0a30de00c5afe152302d +size 105 diff --git a/S2OJ/1745/data/lycoris5.out b/S2OJ/1745/data/lycoris5.out new file mode 100644 index 00000000..95025a2a --- /dev/null +++ b/S2OJ/1745/data/lycoris5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:476f6bfb4cb30d903670d6ccdd3d93f129a27e09fffdf83a1c9316e5d66a578f +size 10 diff --git a/S2OJ/1745/data/lycoris6.in b/S2OJ/1745/data/lycoris6.in new file mode 100644 index 00000000..44903c13 --- /dev/null +++ b/S2OJ/1745/data/lycoris6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc4bfb4215403e3febd7620e39b44935998d4296b5ae8fc8f0916204fcde7736 +size 101 diff --git a/S2OJ/1745/data/lycoris6.out b/S2OJ/1745/data/lycoris6.out new file mode 100644 index 00000000..708d6aed --- /dev/null +++ b/S2OJ/1745/data/lycoris6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:859f4c42f9c0b8c97757096f6c267cbebd556194ef83c2cf7b151b035fc6afe7 +size 10 diff --git a/S2OJ/1745/data/lycoris7.in b/S2OJ/1745/data/lycoris7.in new file mode 100644 index 00000000..4be956ae --- /dev/null +++ b/S2OJ/1745/data/lycoris7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d292232794f3d66e90c5737386c74bf5fc2d5d69da86da53e22f87bbc235505c +size 1006 diff --git a/S2OJ/1745/data/lycoris7.out b/S2OJ/1745/data/lycoris7.out new file mode 100644 index 00000000..9754a2bf --- /dev/null +++ b/S2OJ/1745/data/lycoris7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b05d382cf4f4d09007691a8eca486e370ce7c6ced2f17561e86d3d3af1dbadb +size 10 diff --git a/S2OJ/1745/data/lycoris8.in b/S2OJ/1745/data/lycoris8.in new file mode 100644 index 00000000..5a9b142c --- /dev/null +++ b/S2OJ/1745/data/lycoris8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d64dae9bfcb6025d8b652058d559e8ceb4df4405c2d2bbb7b7785cc7d7946f3 +size 1006 diff --git a/S2OJ/1745/data/lycoris8.out b/S2OJ/1745/data/lycoris8.out new file mode 100644 index 00000000..fb20dbd0 --- /dev/null +++ b/S2OJ/1745/data/lycoris8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:baa690af36869bd6ad2363798d3ef85cff52c19707f4bab7dfae66676c3c1a49 +size 10 diff --git a/S2OJ/1745/data/lycoris9.in b/S2OJ/1745/data/lycoris9.in new file mode 100644 index 00000000..513680b4 --- /dev/null +++ b/S2OJ/1745/data/lycoris9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02d47aae1fca0eb9de1c56b76f292d8a45e2b5eab76310b3ac6044c32f2ac6bc +size 1004 diff --git a/S2OJ/1745/data/lycoris9.out b/S2OJ/1745/data/lycoris9.out new file mode 100644 index 00000000..9b312b69 --- /dev/null +++ b/S2OJ/1745/data/lycoris9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b5558b14579acb0e7ac93197e538c06359421c2ef4c204686da37ee5f42d392 +size 10 diff --git a/S2OJ/1745/data/problem.conf b/S2OJ/1745/data/problem.conf new file mode 100644 index 00000000..8d9452d5 --- /dev/null +++ b/S2OJ/1745/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e72062eda668e1453a4eb1edc381e3bc5005d409c0645b6ddf0b8a4066c5d1eb +size 423