Submission #199787

#TimeUsernameProblemLanguageResultExecution timeMemory
199787aer0parkRice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define f first #define s second using namespace std; typedef long long ll; typedef pair<ll,ll> pi; ll r,l,b,x[100005],sum,anw,cnt=1; queue<ll> st,ed; int ricehub() { ios::sync_with_stdio(false); cin.tie(NULL); cin>>r>>l>>b; for(int i=1;i<=r;i++) cin>>x[i]; x[r+1]=l+1; for(int i=1;i<=r;i++) { sum+=(st.size()-ed.size())*(x[i]-x[i-1]); if(!ed.empty()) st.push(ed.front()),ed.pop(); else st.push(cnt),cnt++; if(sum<=b) anw=max(anw,(ll)st.size()+(ll)ed.size()); while(st.size()>=2&&(sum>b||x[i]-x[st.front()]>=x[cnt]-x[i])) sum-=x[i]-x[st.front()],st.pop(); while(cnt<=r&&sum+x[cnt]-x[i]<=b) ed.push(cnt),sum+=x[cnt]-x[i],cnt++; anw=max(anw,(ll)st.size()+(ll)ed.size()); } return anw; }

Compilation message (stderr)

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