# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1123222 | nguyenhx2k7 | 쌀 창고 (IOI11_ricehub) | C++20 | 0 ms | 0 KiB |
/*
░▒▓████████▓▒░▒▓█▓▒░ ░▒▓██████▓▒░░▒▓█▓▒░░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓███████▓▒░ ░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓████████▓▒░ ░▒▓███████▓▒░░▒▓████████▓▒░░▒▓███████▓▒░▒▓████████▓▒░
░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░
░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░
░▒▓██████▓▒░ ░▒▓█▓▒░ ░▒▓████████▓▒░▒▓█▓▒░▒▓████████▓▒░ ░▒▓█▓▒░░▒▓██████▓▒░ ░▒▓█▓▒░ ░▒▓████████▓▒░▒▓██████▓▒░ ░▒▓███████▓▒░░▒▓██████▓▒░ ░▒▓██████▓▒░ ░▒▓█▓▒░
░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░
░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░
░▒▓████████▓▒░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░▒▓███████▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓████████▓▒░ ░▒▓███████▓▒░░▒▓████████▓▒░▒▓███████▓▒░ ░▒▓█▓▒░
*/
#include <bits/stdc++.h>
#define nelaia ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll>
#define vp vector<pll>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend();
#define name "fields."
#define initiation freopen(name"inp", "r", stdin);freopen(name"out", "w", stdout);
#define BIT(x, i) (((x) >> (i)) & 1)
#define MASK(i) (1 << (i))
using namespace std;
const ll maxn = 1e5 + 5;
const ll INF = 1e9 + 7;
const ll LINF = 1e18;
const ll mod = 1e9 + 7;
ll calc(ll R, ll L, ll a[], ll B){
vll pos(R + 5, 0);
for(ll i = 1; i <= R; i++){
pos[i + 1] = pos[i] + a[i];
}
ll r = 0, ans = 1;
for(ll l = 0; l <= R; l++){
while(r < R){
ll m = (l + r) / 2;
ll tmp = 0;
if((l + r + 1) % 2 != 0){
tmp -= a[m];
}
tmp -= pos[m] - pos[l];
tmp += pos[r + 1] - pos[m];
if(tmp > B){
break;
}
r++;
}
ans = max(ans, r - l);
if(r == R){
break;
}
}
return ans;
}
ll a[maxn];
void process(){
ll r, l, b;
cin >> r >> l >> b;
for(ll i = 1; i <= r; i++) cin >> a[i];
cout << calc(r, l, a, b);
}
int main()
{
nelaia
// initiation
ll sub;
cin >> sub;
ll time;
time = 1;
// cin >> time;
while(time--){
process();
}
return 0;
}