제출 #1241854

#제출 시각아이디문제언어결과실행 시간메모리
1241854Zbyszek99Packing Biscuits (IOI20_biscuits)C++20
12 / 100
7 ms492 KiB
#include "biscuits.h" #include <bits/stdc++.h> #define ll long long #define ld long double #define vi vector<int> #define vl vector<long long> #define ff first #define ss second #define pii pair<int,int> #define pll pair<long long, long long> #define pb push_back #define rep(i, b) for(int i = 0; i < (b); ++i) #define rep2(i,a,b) for(int i = a; i <= (b); ++i) #define rep3(i,a,b,c) for(int i = a; i <= (b); i+=c) #define count_bits(x) __builtin_popcountll((x)) #define all(x) (x).begin(),(x).end() #define siz(x) (int)(x).size() #define forall(it,x) for(auto& it:(x)) using namespace std; const int INF = 1e9+50; const ll INF_L = 1e18+40; const ll MOD = 1e9+7; map<ll,ll> dp; ll pref[61]; ll y; ll rek(ll x) { if(x < 0) return 0; if(dp.find(x) != dp.end()) return dp[x]; ll bit = __lg(x); dp[x] = rek((1LL << bit)-1) + rek(min(x - (1LL << bit),(pref[bit]-y*(1LL << bit))/y)); return dp[x]; } ll count_tastiness(ll X, vl a) { dp = {}; y = X; ll cur = 0; rep(i,61) { if(i < siz(a)) cur += a[i] * (1LL << (ll)i); pref[i] = cur; } dp[0] = 1; return rek((1LL << 61LL)); }
#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...