Submission #1207961

#TimeUsernameProblemLanguageResultExecution timeMemory
1207961CyanmondPacking Biscuits (IOI20_biscuits)C++20
Compilation error
0 ms0 KiB
#include "biscuits.h"

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

constexpr int n = 63;
ll a[64], dp[64];

long long count_tastiness(long long x, std::vector<long long> a_) {
  fill(a, a + n + 1, 0);
  copy(a_.begin(), a_.end(), a);
	for (int i = 0; i < n; ++i) {
		if (a[i] > x + 1) {
			ll diff = a[i] - (x + 1);
			ll div = (diff + 1) / 2;
			a[i] -= div * 2;
			a[i + 1] += div;
		}
	}

	reverse(a.begin(), a.end());
	fill(dp, dp + n + 1, 0);
	dp[0] = 1;
	for (int i = 0; i < n; ++i) {
		// case 1: no
		dp[i + 1] += dp[i];
		// case 2: yes
		if (a[i] >= x) {
			dp[i + 1] += dp[i];
			continue;
		}

		ll lack = x;
		for (int j = i; j < n; ++j) {
			lack -= a[j];
			if (lack <= 0) {
				dp[j + 1] += dp[i];
				lack += x;
			}
			lack *= 2;
			if (lack > 3 * x) {
				break;
			}
		}
	}

	return dp[n];
}

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:27:19: error: request for member 'begin' in 'a', which is of non-class type 'll [64]' {aka 'long long int [64]'}
   27 |         reverse(a.begin(), a.end());
      |                   ^~~~~
biscuits.cpp:27:30: error: request for member 'end' in 'a', which is of non-class type 'll [64]' {aka 'long long int [64]'}
   27 |         reverse(a.begin(), a.end());
      |                              ^~~