# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
376563 | Jarif_Rahman | Packing Biscuits (IOI20_biscuits) | C++17 | 1146 ms | 887772 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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
const int kk = 60;
ll count_tastiness(ll x, vector<ll> aa){
vector<__int128_t> a(kk);
int k = aa.size();
for(int i = 0; i < k; i++) a[i] = aa[i];
ll ans = 0;
vector<__int128_t> s(kk, 0);
for(int i = 0; i < kk; i++){
if(i != 0) s[i] = s[i-1];
s[i]+=a[i]*(1LL<<i);
}
vector<__int128_t> v;
v.pb({0});
for(int i = 0; i < kk; i++){
__int128_t mx = s[i]/x, p = 1;
p<<=i;
mx-=p;
__int128_t zero = 0;
mx = max(mx, zero);
int in = upper_bound(v.begin(), v.end(), mx) - v.begin();
for(int j = 0; j < in; j++) v.pb(v[j]+p);
}
return v.size();
}
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... |