# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28925 | aybala | Rice Hub (IOI11_ricehub) | C++11 | 16 ms | 6316 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>
#define fori(a,b,c) for(a=b;a<c;a++)
#define ford(a,b,c) for(a=b;a>=c;a--)
#define pb push_back
#define pii pair<int,int>
#define mii map<int,int>
#define mp make_pair
#define pcc pair<char,char>
#define ll long long
#define pll pair<long long,long long>
#define fi first
#define se second
#define pss pair<short, short>
#define pq priority_queue
using namespace std;
int sum[100004];
int besthub(int R, int L, int X[], long long B)
{
int l,r;
sum[0]=X[0];
int i,j,k;
fori(i,1,R){
sum[i]+=sum[i-1]+X[i];
}
int ans=0;
r=0;
fori(l,0,R){
while(r<R){
int mid=(l+r)/2;
ll b=0;
b+=(long long)X[mid]*(mid-l);
if(mid)
b-=sum[mid-1];
if(l)
b+=sum[l-1];
b+=(long long)sum[r]-sum[mid]-(long long)X[mid]*(r-mid);
if(b>B)
break;
r++;
}
ans=max(ans,r-l);
}
R=ans;
return R;
}
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... |