# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
302644 | errorgorn | Rice Hub (IOI11_ricehub) | C++17 | 20 ms | 1792 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
int besthub(int n, int L, int arr[], long long k){
int m=0,r=-1;
ll curr=0;
int ans=0;
rep(l,0,n){
if (m<l+r>>1){
curr-=(arr[m+1]-arr[m])*((r-m)-(m-l+1));
m++;
}
//cout<<l<<" "<<m<<" "<<r<<" "<<curr<<endl;
while (curr<=k){
ans=max(ans,r-l+1);
if (r==n-1) break;
r++;
curr+=arr[r]-arr[m];
if (m<l+r>>1){
curr-=(arr[m+1]-arr[m])*((r-m)-(m-l+1));
m++;
}
}
curr-=arr[m]-arr[l];
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |