0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 16:58:48 +00:00

T228727 「Wdoi-5」樱点收集

R71876340
This commit is contained in:
Baoshuo Ren 2022-03-20 13:09:53 +08:00
parent 8005fa0ac8
commit 6baf86010c
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68
9 changed files with 63 additions and 0 deletions

39
Luogu/T228727/T228727.cpp Normal file
View File

@ -0,0 +1,39 @@
#include <iostream>
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;
}

BIN
Luogu/T228727/data/ex_sakura1.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Luogu/T228727/data/ex_sakura1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Luogu/T228727/data/ex_sakura2.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Luogu/T228727/data/ex_sakura2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Luogu/T228727/data/ex_sakura3.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Luogu/T228727/data/ex_sakura3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Luogu/T228727/data/ex_sakura4.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Luogu/T228727/data/ex_sakura4.in (Stored with Git LFS) Normal file

Binary file not shown.