Submission #120028

# Submission time Handle Problem Language Result Execution time Memory
120028 2019-06-23T05:24:28 Z turbat Rice Hub (IOI11_ricehub) C++14
0 / 100
6 ms 640 KB
#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;
#define N 100005

long long s[N];

bool can(int l, int r, long long cost){
	int mid = (l + r) / 2;
	return cost >= s[r] - s[mid] - ((r - l) % 2 == 0 ? s[mid + 1] - s[mid] : 0);
}

int besthub(int R, int L, int X[], long long B){
	int ans = 0;
	s[0] = X[0];	
	for (int i = 1;i < R;i++) s[i] = s[i - 1] + X[i];
	for (int i = 0;i < R;i++){
		int l = i, r = R - 1, mid;
		while (l != r){
			mid = (l + r + 1) / 2;
			if (can(l, mid, B)) l = mid;
			else r = mid - 1;
		}
		ans = max(ans, l - i + 1);
	}
  return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -