Submission #1283933

#TimeUsernameProblemLanguageResultExecution timeMemory
1283933faricaPacking Biscuits (IOI20_biscuits)C++20
Compilation error
0 ms0 KiB
#include "biscuits.h"
#include <bits/stdc++.h>

using ll = long long;
const ll INF = 1e18;

long long count_tastiness(long long x, std::vector<long long> a) {
  int k = (int)a.size();
  vector<ll>dp(60, 0);
  ll ans = 0;
  for(int i=0; i<60; ++i) {
    int j = i;
    if((1LL<<i) > INF/x) continue;
    ll sum = x * (1LL<<i);
    for(; j>=0; --j) {
      sum -= a[j] * (1LL<<j);
      if(sum <= 0) break;
    }
    if(j) dp[i] = dp[j-1];
    else dp[i] = 1;
    ans += dp[i];
  }
  
	return ans;
}

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:9:3: error: 'vector' was not declared in this scope
    9 |   vector<ll>dp(60, 0);
      |   ^~~~~~
biscuits.cpp:9:3: note: suggested alternatives:
In file included from /usr/include/c++/13/vector:66,
                 from biscuits.h:1,
                 from biscuits.cpp:1:
/usr/include/c++/13/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/13/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
biscuits.cpp:9:12: error: expected primary-expression before '>' token
    9 |   vector<ll>dp(60, 0);
      |            ^
biscuits.cpp:9:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
    9 |   vector<ll>dp(60, 0);
      |             ^~
      |             dup