Submission #109875

# Submission time Handle Problem Language Result Execution time Memory
109875 2019-05-08T08:43:56 Z Nucleist Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h> 
using namespace std; 
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
vector<ll> lom;
ll besthub(ll r,ll l,ll x,ll b)
{
  //flash;
  cin>>r>>l>>b;
  for (ll i = 0; i < r; ++i)
  {
    ll yom;
    cin>>yom;
    lom.pb(yom);
    //if(lom.size()>1)lom[lom.size()-1]+=lom[lom.size()-2];
  }
  ll glob = 0;
  ll ans=0;
  for (ll i = 0; i < r; ++i)
  {
    for (ll j = i+1; j < r; ++j)
    {
      ll med = (lom[j]+lom[i])/2;
      ll ans = 0;
      for (ll s = i; s <= j; ++s)
      {
        ans+=abs(lom[s]-med);
      }
      //debug(ans);
      //debugs(i,j);
      if(ans<=b)
        glob=max(glob,j-i+1);
    }
  }
  return glob;
}

Compilation message

ricehub.cpp: In function 'long long int besthub(long long int, long long int, long long int, long long int)':
ricehub.cpp:29:6: warning: unused variable 'ans' [-Wunused-variable]
   ll ans=0;
      ^~~
/tmp/ccj0aRz6.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