Submission #971751

# Submission time Handle Problem Language Result Execution time Memory
971751 2024-04-29T08:56:52 Z batsukh2006 Rice Hub (IOI11_ricehub) C++17
0 / 100
2 ms 604 KB
#include<bits/stdc++.h>
using namespace std;
#define ss second
#define ff first
#define endl '\n'
int besthub(int r, int l, int x[], long long b){
	int ans=0,m=0;
	long long cost=0;
	for(int i=0,j=0; i<r; i++){
		cost+=x[i]-x[m];
		int mid=(i+j)/2;
		cost+=(x[mid]-x[m])*(mid-j);
		cost-=(x[mid]-x[m])*(i-mid+1);
		m=mid;
		while(cost>b){
			cost-=x[m]-x[j];
			int mid=(i+j+1)/2;
			cost+=(x[mid]-x[m])*(mid-j-1);
			cost-=(x[mid]-x[m])*(i-mid+1);
			j++;
		}
		ans=max(ans,i-j+1);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Incorrect 2 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -