Submission #914714

#TimeUsernameProblemLanguageResultExecution timeMemory
914714DucNguyen2007Rice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long const int maxN=1e5+5; ll sum[maxN+1]; ll get(ll l,ll r) { if(l==0) { return sum[r]; } else return sum[r]-sum[l-1]; } ll besthub(ll L,ll n,ll a[],ll B) { sum[0]=a[0]; for(int i=1;i<n;i++) { sum[i]=sum[i-1]+a[i]; } for(int len=1;len<=n;len++) { ll l=0,r=len-1; while(r<n) { ll p=(l+r)/2; ll cur=(p-l+1)*a[p]-get(l,p)+get(p,r)-(r-p+1)*a[p]; if(cur<=B) { return len; } } } }

Compilation message (stderr)

ricehub.cpp: In function 'long long int besthub(long long int, long long int, long long int*, long long int)':
ricehub.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
   34 | }
      | ^
/usr/bin/ld: /tmp/ccFJlTYM.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