# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773780 | ono_de206 | Packing Biscuits (IOI20_biscuits) | C++14 | 13 ms | 380 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 in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
// #define int long long
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
long long count_tastiness(long long x, vector<long long> a) {
const long long inf = 1e18;
while(a.size() < 62) {
a.pb(0);
}
vector<int> s{0};
for(int i = 0; i < 62; i++) {
s.pb(s.back() + a[i] * (1LL << i));
}
map<long long, long long> mp;
mp[0] = 1;
if(a[0] >= x) mp[1] = 1;
else mp[1] = 0;
function<long long(long long)> solve = [&](long long n) {
if(mp.find(n) != mp.end()) return mp[n];
long long &ret = mp[n];
int i = 0;
while((1ll << i) < n) {
i++;
}
ret = solve(1ll << (i - 1)) + solve(min(n, 1 + s[i] / x) - (1ll << (i - 1)));
return ret;
};
return solve((long long)1e18);
}
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... |