Submission #409567

# Submission time Handle Problem Language Result Execution time Memory
409567 2021-05-21T05:35:40 Z 600Mihnea Rice Hub (IOI11_ricehub) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "rice.h"

using namespace std;

typedef long long ll;

const int N = 100000 + 7;
int n, len, x[N];
ll b;

deque<int> positions;

ll compute() {
  int x = positions[(int) positions.size() / 2];
  ll cost = 0;
  for (auto &p : positions) {
    cost += abs(x - p);
  }
  return cost;
}

int besthub(int r, int dim, int rice_fields[], ll gold_coins) {
  n = r;
  len = dim;
  for (int i = 1; i <= n; i++) {
    x[i] = rice_fields[i - 1];
  }
  b = gold_coins;
  int sol = 0;
  for (int i = 1; i <= n; i++) {
    positions.push_back(x[i]);
    while (compute() > b) {
      positions.pop_front();
    }
    sol = max(sol, (int) positions.size());
  }
  return sol;
}

Compilation message

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