답안 #80190

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
80190 2018-10-19T13:44:27 Z farukkastamonuda 쌀 창고 (IOI11_ricehub) C++14
컴파일 오류
0 ms 0 KB
#include "ricehub.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long 
#define inf 1000000000
#define md 1000000007
#define li 100005
#define mp make_pair
#define pb push_back
using namespace std;
lo int n,T[10],mx,b,A[li],pre[li],ans;
bool chechk(int l,int r){
	int mid=(l+r)/2;
	lo int sum=A[mid]*(mid-l+1)-(pre[mid]-pre[l-1]);
	sum+=(pre[r]-pre[mid-1])-A[mid]*(r-mid+1);
	return sum<=b;
}
lo int besthub(int R,int L,int X[],lo int B){
	n=R;
	for(int i=1;i<=n;i++) A[i]=X[i-1];
	mx=L;
	b=B;
	for(int i=1;i<=n;i++) pre[i]=pre[i-1]+A[i];
	for(int i=1;i<=n;i++){
		lo int l=i,r=n;
		while(l<=r){
			int mid=(l+r)/2;
			if(chechk(i,mid)) l=mid+1;
			else r=mid-1;
		}
		ans=max(ans,l-i);
	}
	return ans;
}

Compilation message

ricehub.cpp: In function 'long long int besthub(int, int, int*, long long int)':
ricehub.cpp:19:8: error: ambiguating new declaration of 'long long int besthub(int, int, int*, long long int)'
 lo int besthub(int R,int L,int X[],lo int B){
        ^~~~~~~
In file included from ricehub.cpp:1:0:
ricehub.h:1:5: note: old declaration 'int besthub(int, int, int*, long long int)'
 int besthub(int R, int L, int X[], long long B);
     ^~~~~~~