# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
837100 | 2023-08-24T23:30:47 Z | azatega | Packing Biscuits (IOI20_biscuits) | C++14 | 1000 ms | 63284 KB |
#include <iostream> #include <map> #include <vector> using namespace std; #define ll long long map<pair<int, ll>, ll> memo; vector<ll> a; int n; ll x; ll compute(int k, ll amount){ if(memo[{k, amount}] > 0) return memo[{k, amount}]; if(k == a.size() - 1){ // last one ll res = 1; // can always be zero if(amount >= x) // can be 1 res++; memo[{k, amount}] = res; return res; } ll res = 0; if(amount >= x) res += compute(k+1, a[k+1] + (amount - x)/2); // can be 1 res += compute(k+1, a[k+1] + amount/2); // can be 0 memo[{k, amount}] = res; // cout << k << " - " << amount << ": " << memo[{k, amount}] << endl; return res; } long long count_tastiness(long long _x, vector<long long> _a){ memo.clear(); a = _a; x = _x; n = _a.size(); for(int i = 0; i < 100; i++) a.push_back(0); for(int i = 0; i < 99; i++){ if(a[i] >= _x + 2){ a[i] -= _x; a[i+1] += a[i]/2; a[i] = _x; } } return compute(0, a[0]); }
Compilation message
# | 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 | 194 ms | 21924 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1065 ms | 63284 KB | Time limit exceeded |
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 | - |