Submission #1186773

#TimeUsernameProblemLanguageResultExecution timeMemory
1186773the_coding_poohPacking Biscuits (IOI20_biscuits)C++20
0 / 100
4 ms328 KiB
#include "biscuits.h"
#include <bits/stdc++.h>

using namespace std;

#define uwu return

long long count_tastiness(long long x, vector<long long> a) {
	long long ans = 0;
	while(a.size() < 62){
		a.push_back(0);
	}
	for (int i = 0; i < a.size(); i++){
		vector <long long> b = a;
		long long tmp = 0;
		for (int j = 0; j < i; j++){
			tmp += b[j] * (1LL << j);
			b[j] = 0;
		}
		b[i] += tmp / (1LL << i);
		if(b[i] < x)
			continue;
		long long cnt = 0;
		for (int j = i; j < b.size(); j++){
			if(b[j] >= x){
				b[j + 1] += (b[j] - x) / 2;
				b[j] = x;
				cnt++;
			}
		}
		ans += (1LL << (cnt - 1));
	}
	return ans + 1;
}

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