# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
810404 | I_Love_EliskaM_ | Packing Biscuits (IOI20_biscuits) | C++17 | 10 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0;i<n;++i)
#define pb push_back
#define all(x) x.begin(), x.end()
using ll = long long;
#define pi pair<int,int>
#define f first
#define s second
#define int ll
map<int,int> mem;
int s[61];
ll x;
int f(int n) {
if (n<=0) return 0;
if (n==1) return 1;
if (mem.count(n)) return mem[n];
int p=1;
int i=0;
while (2*p<n) p<<=1, ++i;
int a = f(p);
int b = f(min(n, s[i]/x+1)-p);
mem[n]=a+b;
return mem[n];
}
ll count_tastiness(ll _x, vector<ll> a) {
x=_x;
mem.clear();
forn(i,60) s[i]=0;
s[0]=a[0];
forn(i,a.size()) if (i) s[i]=s[i-1]+(a[i]<<i);
for (int i=0; i<=60; ++i) f(1ll<<i);
return mem[1ll<<60];
}
#undef int
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |