제출 #154831

#제출 시각아이디문제언어결과실행 시간메모리
154831davitmarg쌀 창고 (IOI11_ricehub)C++17
컴파일 에러
0 ms0 KiB
/*DavitMarg*/ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <set> #include <queue> #include <iomanip> #include <bitset> #include <stack> #include <cassert> #include <iterator> #include <ctype.h> #include <fstream> #define mod 1000000007ll #define LL long long #define LD long double #define MP make_pair #define PB push_back #define all(v) v.begin (),v.end() using namespace std; int n,ans; LL x[100005],pr[100005],len,s; LL cost(int l,int r) { int m=(l+r)/2; LL res=0; res+=(pr[r]-pr[m])-((r-m)*x[m]); res+=(pr[m]-pr[l])-((m-l)*x[l]); //cout<<l<<" : "<<r<<" = "<<res<<endl; return res; } bool check(LL k) { int l,r; l=1; r=k; while(r<=n) { if(cost(l,r)<=s) return 1; l++; r++; } return 0; } int besthub(int N,LL L,LL X[],LL B) { n=N; len=L; s=B; for(int i=1;i<=n;i++) x[i]=X[i-1]-X[0]+1; for(int i=1;i<=n;i++) pr[i]=pr[i-1]+x[i]; int l,r,m; l=1; r=n; while(l<=r) { m=(l+r)/2; if(check(m)) { l=m+1; ans=m; } else r=m-1; } return ans; } #ifdef death int main() { LL N,L,X[102],B; cin>>N>>L>>B; for(int i=0;i<N;i++) cin>>X[i]; cout<<besthub(N,L,X,B)<<endl;; return 0; } #endif /* 2 4 5 1 2 4+5+1 */

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

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