mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 20:48:48 +00:00
T228727 「Wdoi-5」樱点收集
R71876340
This commit is contained in:
parent
8005fa0ac8
commit
6baf86010c
39
Luogu/T228727/T228727.cpp
Normal file
39
Luogu/T228727/T228727.cpp
Normal 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
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
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
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
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
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
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
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
BIN
Luogu/T228727/data/ex_sakura4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user