Submission #1067498

#TimeUsernameProblemLanguageResultExecution timeMemory
1067498LalicPacking Biscuits (IOI20_biscuits)C++17
0 / 100
3 ms348 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(). x.rend()
#define mp make_pair

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<double> cd;

long long count_tastiness(long long x, vector<long long> a) {
	a.resize(61);
	vector<ll> res(61, 0);
	res[0]=1;
	if(a[0]) res[0]=2;
	
	for(ll i=1;i<=60;i++){
		res[i]=res[i-1];
		if(a[i]){
			res[i]<<=1ll;
			continue;
		}
		
		ll tot=0ll;
		for(ll j=i-1ll;j>=0ll;j--){
			tot+=a[j];
			if(tot>=(1ll<<(i-j))){
				res[i]+=res[j];
				break;
			}
			tot<<=1ll;
		}
	}
	
	for(int i=0;i<5;i++) cout << i << " " << res[i] << "\n";
	return res[60];
}

#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...