mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 14:38:47 +00:00
4385. [POI2015] Wilcze doły
https://hydro.ac/d/bzoj/record/6322ea7dbdf9bc31d1609d17
This commit is contained in:
parent
e429788bf5
commit
2e41798985
47
BZOJ/4385/4385.cpp
Normal file
47
BZOJ/4385/4385.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 2e6 + 5;
|
||||||
|
|
||||||
|
int n, d, a[N], ans;
|
||||||
|
long long p, sum, s[N], t[N];
|
||||||
|
std::deque<int> q;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
cin >> n >> p >> d;
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
cin >> a[i];
|
||||||
|
|
||||||
|
s[i] = s[i - 1] + a[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
t[i] = s[i] - s[i - d];
|
||||||
|
}
|
||||||
|
|
||||||
|
ans = d;
|
||||||
|
sum = s[d + 1];
|
||||||
|
q.push_back(d);
|
||||||
|
|
||||||
|
for (int i = d + 1, l = 1, r = 0; i <= n; sum += a[++i]) {
|
||||||
|
while (!q.empty() && t[q.back()] <= t[i]) q.pop_back();
|
||||||
|
q.push_back(i);
|
||||||
|
while (sum - t[q.front()] > p) {
|
||||||
|
if (q.front() < l + d) q.pop_front();
|
||||||
|
sum -= a[l++];
|
||||||
|
}
|
||||||
|
ans = std::max(ans, i - l + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << ans << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
BZOJ/4385/data/1.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/1.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/10.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/10.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/11.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/11.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/12.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/12.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/13.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/13.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/14.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/14.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/15.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/15.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/16.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/16.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/17.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/17.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/18.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/18.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/19.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/19.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/2.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/2.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/20.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/20.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/21.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/21.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/22.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/22.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/23.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/23.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/24.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/24.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/25.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/25.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/26.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/26.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/27.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/27.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/28.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/28.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/29.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/29.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/3.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/3.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/30.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/30.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/30.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/31.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/31.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/31.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/32.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/32.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/32.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/33.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/33.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/33.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/33.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/34.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/34.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/34.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/34.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/35.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/35.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/35.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/35.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/36.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/36.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/36.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/36.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/37.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/37.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/37.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/37.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/38.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/38.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/38.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/38.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/39.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/39.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/39.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/39.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/4.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/4.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/40.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/40.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/40.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/40.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/41.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/41.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/41.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/41.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/42.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/42.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/42.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/42.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/43.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/43.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/43.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/43.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/44.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/44.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/44.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/44.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/45.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/45.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/45.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/45.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/46.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/46.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/46.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/46.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/47.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/47.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/47.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/47.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/48.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/48.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/48.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/48.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/49.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/49.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/49.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/49.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/5.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/5.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/50.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/50.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/50.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/50.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/51.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/51.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/51.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/51.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/52.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/52.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/52.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/52.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/53.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/53.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/53.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/53.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4385/data/54.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4385/data/54.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user