이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//by szh
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}
#include "biscuits.h"
ll ans[60],mx[60];
ll getval(int cur,ll val) {
if (val<0) return 0;
if (val==0) return 1;
if (val-(1ll<<cur)>=mx[cur]) return ans[cur];
return getval(cur-1,val) + getval(cur-1,val-(1ll<<cur));
}
long long count_tastiness(long long x, std::vector<long long> a) {
while (SZ(a)<60) a.pb(0);
ans[0] = a[0]>=x?2:1;
ll pre = a[0];
rep(i,1,60) {
pre += a[i]*(1ll<<i);
ll tmp = (pre-x*(1ll<<i));
tmp/=x;
tmp = min(tmp,(1ll<<i)-1);
mx[i] = tmp;
ans[i] = ans[i-1] + getval(i-1,tmp);
}
return ans[59];
}
# | 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... |