답안 #229441

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
229441 2020-05-04T13:50:54 Z kshitij_sodani 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef int64_t llo;
#define mp make_pair
#define a first
#define b second
#define pb push_back
#include <ricehub.h>
int besthub(int n,int coo,int it[],int b){
	int l,r;
	int tot=0;
	int ma=0;
	for(int i=0;i<n;i++){
		if(i==0){
			l=0;
			r=-1;
			for(int j=0;j<n;j++){
				if(tot+it[j]-it[0]<=b){
					tot+=(it[j]-it[0]);
					r+=1;
				}
				else{
					break;
				}
			}
			ma=max(ma,r-l+1);
		}
		else{
			tot+=abs(it[i]-it[i-1])*abs(l-i);
			tot-=abs(it[i]-it[i-1])*abs(r-i+1);
			for(int j=r+1;j<n;j++){
				if(abs(it[j]-it[i])<=abs(it[i]-it[l])){
					r+=1;
					tot+=abs(it[j]-it[i]);
					if(tot>b){
						l+=1;
						tot-=abs(it[i]-it[l-1]);
					}
				}
				else{
					break;
				}
			}
			ma=max(ma,r-l+1);
		}

	}

	return ma;
}
/*int main(){
	int cc[5];
	cc[0]=1;
	cc[1]=2;
	cc[2]=10;
	cc[3]=12;
	cc[4]=14;
	cout<<besthub(5,20,cc,6)<<endl;
 
	return 0;
}*/

Compilation message

/tmp/ccy1hSxG.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