Submission #491284

#TimeUsernameProblemLanguageResultExecution timeMemory
491284niloyrootRice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<ll>; using pl = pair<ll,ll>; #define pb push_back #define form(m,it) for(auto it=m.begin(); it!=m.end(); it++) #define forp(i,a,b) for(ll i=a; i<=b; i++) #define forn(i,a,b) for(ll i=a; i>=b; i--) #define newl '\n' #define ff first #define ss second const ll mod = 1000000007; ll besthub(ll r, ll l, ll x[], ll b){ ll ans=0,n,m,cnt,temp; forp(i,0,r-1){ n=i-1,m=i+1; cnt=1,temp=0; while(temp<=b){ if(n<0 && m>r-1){ break; } else if(n>=0 && m>r-1){ if(temp+(x[i]-x[n])<=b){ temp+=(x[i]-x[n]); n--; cnt++; } else { break; } } else if(m<=r-1 && n<0){ if(temp+(x[m]-x[i])<=b){ temp+=(x[m]-x[i]); m++; cnt++; } else { break; } } else { if(x[m]-x[i]<x[i]-x[n] && temp+(x[m]-x[i])<=b){ temp+=(x[m]-x[i]); m++; cnt++; } else if(temp+(x[i]-x[n])<=b){ temp+=(x[i]-x[n]); n--; cnt++; } else { break; } } } ans=max(ans,cnt); } return ans; }

Compilation message (stderr)

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