Submission #259737

# Submission time Handle Problem Language Result Execution time Memory
259737 2020-08-08T12:38:15 Z uacoder123 Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))

typedef long long int lli;
typedef pair <lli,lli> ii;
typedef pair <lli,ii> iii;
typedef vector <lli> vi;

int besthub(int R, int L, int X[], long long B)
{ 
  lli n=R,ls=0,us=0;
  int l=0,u=-1,m=0;
  lli ans=0;
  for(lli i=0;i<n;++i)
  {
    u++;
    us+=X[i];
    if((u-m+1)>=(m-l)+2)
    {
      ls+=X[m];
      us-=X[m];
      m++;
    }
    while(X[m]*(m-l)-ls+us-X[M]*(u-m+1)>B)
    {
      ls-=X[l];
      l++;
      if((u-m+1)>=(m-l)+2)
      {
        ls+=X[m];
        us-=X[m];
        m++;
      }
    }
    ans=max(ans,lli(u.size()+l.size()));
  }
  return(ans);
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:34:30: error: 'M' was not declared in this scope
     while(X[m]*(m-l)-ls+us-X[M]*(u-m+1)>B)
                              ^
ricehub.cpp:45:23: error: request for member 'size' in 'u', which is of non-class type 'int'
     ans=max(ans,lli(u.size()+l.size()));
                       ^~~~
ricehub.cpp:45:32: error: request for member 'size' in 'l', which is of non-class type 'int'
     ans=max(ans,lli(u.size()+l.size()));
                                ^~~~