From 6baf86010c4cd04dc5826c8ac76349fad9484462 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sun, 20 Mar 2022 13:09:53 +0800 Subject: [PATCH] =?UTF-8?q?T228727=20=E3=80=8CWdoi-5=E3=80=8D=E6=A8=B1?= =?UTF-8?q?=E7=82=B9=E6=94=B6=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R71876340 --- Luogu/T228727/T228727.cpp | 39 +++++++++++++++++++++++++++++++ Luogu/T228727/data/ex_sakura1.ans | 3 +++ Luogu/T228727/data/ex_sakura1.in | 3 +++ Luogu/T228727/data/ex_sakura2.ans | 3 +++ Luogu/T228727/data/ex_sakura2.in | 3 +++ Luogu/T228727/data/ex_sakura3.ans | 3 +++ Luogu/T228727/data/ex_sakura3.in | 3 +++ Luogu/T228727/data/ex_sakura4.ans | 3 +++ Luogu/T228727/data/ex_sakura4.in | 3 +++ 9 files changed, 63 insertions(+) create mode 100644 Luogu/T228727/T228727.cpp create mode 100644 Luogu/T228727/data/ex_sakura1.ans create mode 100644 Luogu/T228727/data/ex_sakura1.in create mode 100644 Luogu/T228727/data/ex_sakura2.ans create mode 100644 Luogu/T228727/data/ex_sakura2.in create mode 100644 Luogu/T228727/data/ex_sakura3.ans create mode 100644 Luogu/T228727/data/ex_sakura3.in create mode 100644 Luogu/T228727/data/ex_sakura4.ans create mode 100644 Luogu/T228727/data/ex_sakura4.in diff --git a/Luogu/T228727/T228727.cpp b/Luogu/T228727/T228727.cpp new file mode 100644 index 00000000..5c0e5c2e --- /dev/null +++ b/Luogu/T228727/T228727.cpp @@ -0,0 +1,39 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 3e5 + 5; + +int n, m, k; +long long now, ans, a[N], b[N], c[N], sum[N]; +bool tag[N]; + +int main() { + std::ios::sync_with_stdio(false); + cin >> n >> m >> k; + for (int i = 1; i <= m; i++) { + cin >> b[i]; + tag[b[i]] = true; + } + for (int i = 1; i <= n; i++) { + cin >> a[i]; + a[i] %= k; + sum[i] = (sum[i - 1] + a[i]) % k; + } + + for (int i = 1; i <= m; i++) { + c[sum[b[i]]]++; + } + ans = c[0]; + for (int i = 1; i <= n; i++) { + if (tag[i]) c[sum[i]]--; + ans = std::max(ans, now + c[a[i]]); + if (!sum[i] && tag[i]) now++; + ans = std::max(ans, now); + } + + cout << ans << endl; + return 0; +} diff --git a/Luogu/T228727/data/ex_sakura1.ans b/Luogu/T228727/data/ex_sakura1.ans new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/Luogu/T228727/data/ex_sakura1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/Luogu/T228727/data/ex_sakura1.in b/Luogu/T228727/data/ex_sakura1.in new file mode 100644 index 00000000..c8578386 --- /dev/null +++ b/Luogu/T228727/data/ex_sakura1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22ce61857768497d8d103117a01417d03f6a399f02c3403b0eaaab4dc59329e7 +size 23 diff --git a/Luogu/T228727/data/ex_sakura2.ans b/Luogu/T228727/data/ex_sakura2.ans new file mode 100644 index 00000000..d76a596d --- /dev/null +++ b/Luogu/T228727/data/ex_sakura2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0b5c2c2211c8d67ed15e75e656c7862d086e9245420892a7de62cd9ec582a06 +size 2 diff --git a/Luogu/T228727/data/ex_sakura2.in b/Luogu/T228727/data/ex_sakura2.in new file mode 100644 index 00000000..7644a125 --- /dev/null +++ b/Luogu/T228727/data/ex_sakura2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0143412fd8a2a27d4e19b94d32b6010b04e49455af2abd1b948904fc6bea18c +size 997 diff --git a/Luogu/T228727/data/ex_sakura3.ans b/Luogu/T228727/data/ex_sakura3.ans new file mode 100644 index 00000000..60f093fb --- /dev/null +++ b/Luogu/T228727/data/ex_sakura3.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9742eb8ee320e006666aef25ae9aeed948247f3125c9cafa7cf97b7e7467dd5 +size 3 diff --git a/Luogu/T228727/data/ex_sakura3.in b/Luogu/T228727/data/ex_sakura3.in new file mode 100644 index 00000000..9a5119ee --- /dev/null +++ b/Luogu/T228727/data/ex_sakura3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c420655dcdf463c124d1ab0f53bf8ad71ec678c1035c1d7be408332769dc528e +size 10816 diff --git a/Luogu/T228727/data/ex_sakura4.ans b/Luogu/T228727/data/ex_sakura4.ans new file mode 100644 index 00000000..db27dc9a --- /dev/null +++ b/Luogu/T228727/data/ex_sakura4.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ea9844ae84eccbf55e8330640865e36c43521e45a1baec24233327aab7e6595 +size 3 diff --git a/Luogu/T228727/data/ex_sakura4.in b/Luogu/T228727/data/ex_sakura4.in new file mode 100644 index 00000000..cc30a0d9 --- /dev/null +++ b/Luogu/T228727/data/ex_sakura4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13aaa259e178b214a4beeff7049a58b025b724e371cae369446ffe75e639c7ef +size 1277882