Submission #70628

# Submission time Handle Problem Language Result Execution time Memory
70628 2018-08-23T07:52:44 Z doowey Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
#include "grader.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll ab(ll x){
  return max(x, -x);
}

const int N = (int)1e5 + 9;
ll pref[N];

ll rq(int a, int b){
  if(a == 0)
    return pref[b];
  else
    return pref[b] - pref[a - 1];
}

int besthub(int n, int L, int X[], ll B){  
  int l = 1, r = n + 1;
  pref[0] = X[0];
  for(int i = 1;i < n;i ++ )
    pref[i] += pref[i - 1];
  int k;
  bool ok;
  int med;
  ll sum = 0;
  while(l + 1 < r){
    k = (l + r)/2;
    ok = false;
    for(int i = 0;i <= n-k;i ++ ){
      med = k / 2;
      sum = 0;
      sum += (1ll * (med + 1) * X[i + med]) - rq(i, med);
      sum += rq(med + 1, i + k - 1) - (1ll * (k - med - 1) * X[i + med]);
      if(sum <= B)
        ok = true;
    }
    if(ok)
      l = k;
    else
      r = k;
  }
  return l;
}

Compilation message

ricehub.cpp:1:10: fatal error: grader.h: No such file or directory
 #include "grader.h"
          ^~~~~~~~~~
compilation terminated.