Submission #227783

# Submission time Handle Problem Language Result Execution time Memory
227783 2020-04-28T19:13:51 Z staniewzki Rice Hub (IOI11_ricehub) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
 
using LL = long long;

#include "ricehub.h"

int besthub(int R, int L, int X[], LL B) {
	vector<LL> sum(R + 1);
	for(int i = 0; i < R; i++)
		sum[i + 1] = sum[i] + X[i];

	auto get = [&](int l, int r) {
		int m = (l + r) / 2;
		return sum[r + 1] - sum[m] - X[m] * (r + 1 - m)
			 + X[m] * (m - l) - sum[m] + sum[l];
	};

	for(int i = 0; i < R; i++)
	REP(i, R)
		while(p < R && get(i, p) <= B)
			ans = max(ans, p++ - i + 1);
	return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, LL)':
ricehub.cpp:20:2: error: 'REP' was not declared in this scope
  REP(i, R)
  ^~~
ricehub.cpp:23:9: error: 'ans' was not declared in this scope
  return ans;
         ^~~
ricehub.cpp:23:9: note: suggested alternative: 'abs'
  return ans;
         ^~~
         abs