Submission #1100323

#TimeUsernameProblemLanguageResultExecution timeMemory
1100323mm77Rice Hub (IOI11_ricehub)C++14
Compilation error
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; }

Compilation message (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