Submission #303986

# Submission time Handle Problem Language Result Execution time Memory
303986 2020-09-20T22:52:13 Z Fdg Packing Biscuits (IOI20_biscuits) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
#include <map>
#include <set>

using namespace std;

vector<long long> trans(const vector<long long>& a, long long sub) {
  vector<long long> na = a;
  na.pop_back();
  if (a.back() - sub > 1) {
    long long val = (a.back() - sub) / 2;
    if (na.size() == 0) na.push_back(val);
    else na.back() += val;
  }
  return na;
}

long long solve(long long x, vector<long long> a) {
  if (a.size() == 0) return 1;

  long long ret = 0;
  if (a.back() >= x) {
    ret += solve(x, trans(a, x));
  }

  ret += solve(x, trans(a, 0));
  return ret;
}

long long count_tastiness(long long x, vector<long long> a) {
  reverse(a.begin(), a.end());
  return solve(x, a);
}

Compilation message

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:32:3: error: 'reverse' was not declared in this scope
   32 |   reverse(a.begin(), a.end());
      |   ^~~~~~~