Submission #390882

# Submission time Handle Problem Language Result Execution time Memory
390882 2021-04-17T09:44:55 Z AlexPop28 Packing Biscuits (IOI20_biscuits) C++14
0 / 100
1000 ms 452 KB
#include "biscuits.h"
#include <bits/stdc++.h>

using namespace std;

int n;

long long Solve(int i, vector<long long> cnt) {
  if (i == (int)cnt.size()) {
    return 1LL;
  }

  if (cnt[i] < n) {
    return Solve(i + 1, cnt);
  }
  long long ret = Solve(i + 1, cnt);
  if (i + 1 == (int)cnt.size()) {
    cnt.emplace_back(0LL);
  }
  cnt[i + 1] += cnt[i] / 2;
  ret += Solve(i + 1, cnt);
  return ret; 
}

long long count_tastiness(long long n, vector<long long> a) {
  ::n = n;
  for (int i = 0; i < (int)a.size(); ++i) {
    if (a[i] > n + 1) {
      if (i + 1 == (int)a.size()) a.emplace_back(0LL);
      a[i + 1] += (a[i] - n) / 2;
    }
  }

  return Solve(0, a);
}

# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 452 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -