# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
412392 | 2021-05-26T19:44:50 Z | achibasadzishvili | Packing Biscuits (IOI20_biscuits) | C++17 | 5 ms | 368 KB |
#include "biscuits.h" #include<bits/stdc++.h> #define ll long long #define f first #define s second #define pb push_back using namespace std; ll pre[505],n; map<ll,ll>got; ll solve(ll k){ if(k == 1)return 1; if(k <= 0)return 0; if(got.count(k))return got[k]; ll ret = 0; ll pw = 1,t = 0; while(2 * pw < k){ t++; pw *= 2; } got[k] = solve(pw) + solve(min(k ,1 + pre[t] / n) - pw); return got[k]; } ll count_tastiness(ll x, vector<ll> a){ got.clear(); for(int i=0; i<=200; i++) pre[i] = 0; for(int i=0; i<a.size(); i++){ if(!i)pre[i] = a[i] * (1LL << i); else pre[i] = pre[i - 1] + a[i] * (1LL << i); } n = x; return solve(pre[(int)a.size() - 1] + 1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 368 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |