Submission #836384

# Submission time Handle Problem Language Result Execution time Memory
836384 2023-08-24T10:46:42 Z NeroZein Packing Biscuits (IOI20_biscuits) C++17
0 / 100
121 ms 340 KB
#include "biscuits.h"
#include "bits/stdc++.h"
using namespace std; 

long long count_tastiness(long long x, std::vector<long long> a) {
  long long ret = 1;
  int k = (int) a.size(); 
  if (x != 1) {
    for (int i = 1; (long long) i * x <= (int) 1e5; ++i) {
      vector<long long> b = a; 
      bool ok = true; 
      for (int rep = 0; rep < x; ++rep) {
        int rem = i;
        for (int j = k - 1; j >= 0; --j) {
          int take = rem / (1LL << j); 
          int can_take = min((long long) take, b[j]); 
          b[j] -= can_take;
          rem -= can_take * (1LL << j); 
        }
        ok &= rem == 0;       
      }
      ret += ok; 
      //if (ok) cout << i << '\n'; 
    }    
  } else {
    long long la = 0;
    for (int i = k - 1; i >= 0; --i) {
      la += la + a[i];
    }
    ret = la + 1; 
  }
  return ret;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 121 ms 284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -