Submission #1207959

#TimeUsernameProblemLanguageResultExecution timeMemory
1207959CyanmondPacking 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_) {
  for (int i = 0; i < int(a.size()); ++i) {
      a[i] = a_[i];
  }
	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;
		}
	}
	a.push_back(0);

	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:16:29: error: request for member 'size' in 'a', which is of non-class type 'll [64]' {aka 'long long int [64]'}
   16 |   for (int i = 0; i < int(a.size()); ++i) {
      |                             ^~~~
biscuits.cpp:27:11: error: request for member 'push_back' in 'a', which is of non-class type 'll [64]' {aka 'long long int [64]'}
   27 |         a.push_back(0);
      |           ^~~~~~~~~
biscuits.cpp:29:19: error: request for member 'begin' in 'a', which is of non-class type 'll [64]' {aka 'long long int [64]'}
   29 |         reverse(a.begin(), a.end());
      |                   ^~~~~
biscuits.cpp:29:30: error: request for member 'end' in 'a', which is of non-class type 'll [64]' {aka 'long long int [64]'}
   29 |         reverse(a.begin(), a.end());
      |                              ^~~