Submission #725442

#TimeUsernameProblemLanguageResultExecution timeMemory
725442MauveRice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
//#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #include<bits/stdc++.h> //using namespace __gnu_pbds; using namespace std; //#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> #define INF 4000000000000000000 #define MOD 1000000007 #define ll long long #define pb push_back #define A 900000011 #define ss second #define endl '\n' #define ff first ll n,m,l,r,i,ii,jj,xx,yy,j,t,x,y,z,T,k,p,ans,a[100005]; bool shaa(ll k){ ll med=(k-1)/2,sum=0,ans; for(ll i=0;i<k;i++) sum+=abs(a[med]-a[i]); ans=sum; for(ll i=k;i<n;i++){ sum-=(a[med]-a[i-k]); sum+=(med-(i-k))*(a[med+1]-a[med]); sum-=(i-1-med)*(a[med+1]-a[med]); med++; sum+=(a[i]-a[med]); ans=min(ans,sum); } if(ans<=p) return true; else return false; } ll besthub(ll R, ll L, ll X[], ll B){ ll l=0,r=R,m; for(int i=0;i<R;i++) a[i]=X[i]; n=R; p=B; while(r-l>1){ m=(r+l)/2; if(shaa(m)) l=m; else r=m-1; } if(shaa(r)) return r; else return l; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccurAGtM.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