답안 #227783

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
227783 2020-04-28T19:13:51 Z staniewzki 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
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