제출 #726246

#제출 시각아이디문제언어결과실행 시간메모리
726246myrcella비스킷 담기 (IOI20_biscuits)C++17
12 / 100
5 ms392 KiB
//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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...