답안 #20804

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20804 2017-02-16T08:14:18 Z jjwdi0 쌀 창고 (IOI11_ricehub) C++11
컴파일 오류
0 ms 0 KB
#define MAX_N 100005
typedef long long ll;

int max(int X, int Y){return X>Y?X:Y;}
int besthub(int R, ll L, ll X[], ll B) {
	int ans = 0;
	int i = 1, j = 1;
	ll cnt = 0LL, A[MAX_N];
	for(int i=R-1; i>=0; i--) X[i+1] = X[i];
	A[0] = 0LL;
	for(int i=1; i<=R; i++) A[i] = A[i-1] + X[i];
	while(i <= R && j <= R) {
		int mid = i + j >> 1;
		while(X[(i+j)/2] * (ll)((i+j)/2 - i + 1) - (A[(i+j)/2] - A[i-1]) + A[j] - X[(i+j)/2] * (ll)(j - (i+j)/2 + 1) - A[(i+j)/2 - 1] > B && i < j) i++;
		ans = max(ans, j - i + 1);
		j++;
	}
	return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, ll, ll*, ll)':
ricehub.cpp:13:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int mid = i + j >> 1;
               ^
ricehub.cpp:13:7: warning: unused variable 'mid' [-Wunused-variable]
   int mid = i + j >> 1;
       ^
ricehub.cpp:8:5: warning: unused variable 'cnt' [-Wunused-variable]
  ll cnt = 0LL, A[MAX_N];
     ^
/tmp/ccFzeYx6.o: In function `main':
grader.cpp:(.text.startup+0x92): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status