Submission #442346

#TimeUsernameProblemLanguageResultExecution timeMemory
442346DmitryGrigorevPacking Biscuits (IOI20_biscuits)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;

const int mod = 1000000007;

void add(int& a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}

int mult(int a, int b) {
  return a * (ll)b % mod;
}

int bp(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) res = mult(res, a);
    a = mult(a, a);
    b >>= 1;
  }
  return res;
}

ll count_tastiness(vector<ll> a, ll x) {

  int k = a.size();

  vector<ll> bounds;
  for (int i = 0; i < 20; ++i) {
    ll sum = 0;
    for (int j = 0; j < min(k, i+1); ++j) {
      sum += (1LL<<j) * a[j];
    }
    bounds.pb(sum / x);
  }

  int ans = 0;
  for (int j = 0; j < (1<<20); ++j) {
    bool can = true;
    for (int e = 0; e < 20; ++e) {
      if ((j+1)%(1<<(e+1)) > bounds[e]) {
        //if (j == 1) cout << (j+1)%(1<<(e+1)) << " " << bounds[e] << endl;
        can = false;
      }
    }
    ans += can;
  }

  return ans;

}


#ifdef LOCAL
int main(){
	freopen("A_input.txt", "r", stdin);
	//freopen("A_output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);

  int k;
  ll x;

  cin >> k >> x;

  vector<ll> v(k);
  for (auto &x : v) cin >> x;

  cout << count_tastiness(v, x) << endl;

}

#endif

Compilation message (stderr)

/usr/bin/ld: /tmp/ccmTE4t6.o: in function `main':
grader.cpp:(.text.startup+0x48b): undefined reference to `count_tastiness(long long, std::vector<long long, std::allocator<long long> >)'
collect2: error: ld returned 1 exit status