제출 #1100323

#제출 시각아이디문제언어결과실행 시간메모리
1100323mm77쌀 창고 (IOI11_ricehub)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int N=1e5+3; long long r,l,b,x[N]; bool ok(int mid) { long long left=0,right=mid-1,sr=(left+right)/2,res=0; for(int i=left;i<=right;i++) { res+=abs(x[i]-x[sr]); } while(right<r) { if(res<=b)return true; res+=(sr-left+1)*(x[sr+1]-x[sr]); res-=(right-sr)*(x[sr+1]-x[sr]); res-=x[sr+1]-x[left]; res+=x[right+1]-x[sr+1]; sr++,right++,left++; } return false; } int besthub(long long r2,long long l2,long long x2[],long long b2) { r=r2,l=l2,b=b2; for(int i=0;i<r;i++)x[i]=x2[i]; int pocz=1,kon=r+1; while(pocz+1<kon) { int mid=(pocz+kon)/2; if(ok(mid))pocz=mid; else kon=mid; } return pocz; }

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

/usr/bin/ld: /tmp/ccz9jWeL.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status