Submission #121024

# Submission time Handle Problem Language Result Execution time Memory
121024 2019-06-26T03:12:46 Z turbat Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;

long long s[100005];

long long can(int l, int r){
	int mid = (l + r) / 2;
	if ((r - l) % 2 == 0) return s[r] + s[l - 1] - s[mid] - s[mid - 1];		
	return s[r] + s[l - 1] - 2 * s[mid];
}

int besthub(int R, int L, int X[], long long B){
	int ans = 0;
	for (int i = 1;i <= R;i++) s[i] = s[i - 1] + X[i - 1];
	for (int i = 1;i <= R;i++){
		int l = i, r = R, mid;
		while (l != r){
			mid = (l + r + 1) / 2;
			if (can(i, mid) <= B) l = mid;
			else r = mid - 1;
		}
		ans = max(ans, l - i + 1);
	}
  return ans;
}

Compilation message

ricehub.cpp:1:1: error: 'include' does not name a type; did you mean '__has_include'?
 include <bits/stdc++.h>
 ^~~~~~~
 __has_include
ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:23:9: error: 'max' was not declared in this scope
   ans = max(ans, l - i + 1);
         ^~~