제출 #229441

#제출 시각아이디문제언어결과실행 시간메모리
229441kshitij_sodani쌀 창고 (IOI11_ricehub)C++17
컴파일 에러
0 ms0 KiB
#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; }*/

컴파일 시 표준 에러 (stderr) 메시지

/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