Submission #563293

# Submission time Handle Problem Language Result Execution time Memory
563293 2022-05-16T19:27:08 Z 1ne Rice Hub (IOI11_ricehub) C++14
0 / 100
99 ms 448 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
  int ans = 0;
  for (int i = 0;i<R;++i){
		int l = 0;
		long long cost = B;
		int left = 0,right = i;
		while(left<=right){
			int mid = (left + right)>>1;
			if (X[i] - X[mid]<=B){
				l = mid;
				right = mid - 1;
			} 
			else left = mid + 1;
		}
		cost-=X[i] - X[l];
		int counts = i - l + 1;
		int j = i + 1;
		ans = max(ans,counts);
		while(j<R && l<=i){
			if (X[j] - X[j - 1]<=cost){
				counts++;
				cost-=X[j] - X[j - 1];
				++j;
			}
			else if (l == i){
				break;
			}
			else{
				cost+=X[l + 1] - X[l];
				counts--;
				++l;
			}
			ans = max(ans,counts);
		}
  }
  return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 448 KB Output isn't correct
2 Halted 0 ms 0 KB -