# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934059 | 2024-02-26T18:21:18 Z | EJIC_B_KEDAX | Packing Biscuits (IOI20_biscuits) | C++17 | 2 ms | 444 KB |
#include <bits/stdc++.h> using ll = long long; using namespace std; mt19937 mt(time(nullptr)); vector<ll> tmp, origin, dp; ll calc(ll x, int pos) { ll sum = (1ll << pos) * tmp[pos]; int ptr = pos; while (ptr > 0 && sum < (1ll << pos) * x) { sum += (1ll << ptr) * tmp[--ptr]; } if (sum < (1ll << pos) * x) { // cout << "! " << pos << '\n'; return (pos ? dp[pos - 1] : 1); } if (ptr == pos) { // cout << "!! " << pos << '\n'; if (ptr == 0) { return 2; } else { return 2 * dp[pos - 1]; } } tmp[ptr] = (sum - (1ll << pos) * x) / (1ll << ptr); ll res = calc(x, ptr); // cout << pos << ' ' << ptr << ' ' << res << '\n'; tmp[ptr] = origin[ptr]; return res + dp[pos - 1]; } ll count_tastiness(ll x, vector<ll> a) { while (a.size() < 60) { a.push_back(0); } int n = 60; for (int i = 0; i < n; i++) { if (a[i] > x + 1) { a[i + 1] += (a[i] - x) / 2; a[i] -= ((a[i] - x) / 2) * 2; } } origin = a; tmp.resize(n); tmp = a; dp.resize(n, 0); for (int i = 0; i < n; i++) { dp[i] = calc(x, i); } return dp[n - 1]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 444 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 360 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 444 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |