# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
392409 |
2021-04-21T04:46:04 Z |
Hazem |
Rice Hub (IOI11_ricehub) |
C++14 |
|
3 ms |
844 KB |
#include <bits/stdc++.h>
using namespace std;
#define S second
#define F first
#define LL long long
const int N = 2e5+10;
const LL MOD = 1e9+7;
const LL LINF = 1e18;
const LL INF = 1e9;
LL a[N],pr[N];
int besthub(int R, int L, int X[], long long B)
{
int n = R;
for(int i=1;i<=n;i++)
a[i] = X[i-1],pr[i] = pr[i-1]+a[i];
int l = 1,r = 1,ans = 0;
while(r<=n){
int mid = (l+r)/2;
LL cost = pr[r]-pr[mid-1]-(r-mid+1)*a[mid]+a[mid]*(mid-l+1)-pr[mid]-pr[l-1];
if(cost<=B)
ans = max(ans,r-l+1),r++;
else
l++;
}
return ans;
}
/*
#define MAX_R 1000000
static int R, L;
static long long B;
static int X[MAX_R];
static int solution;
inline
void my_assert(int e) {if (!e) abort();}
static void read_input()
{
int i;
my_assert(3==scanf("%d %d %lld",&R,&L,&B));
for(i=0; i<R; i++)
my_assert(1==scanf("%d",&X[i]));
my_assert(1==scanf("%d",&solution));
}
int main()
{
int ans;
read_input();
ans = besthub(R,L,X,B);
if(ans==solution)
printf("Correct.\n");
else
printf("Incorrect. Returned %d instead of %d.\n",ans,solution);
return 0;
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
844 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |