Submission #1052539

#TimeUsernameProblemLanguageResultExecution timeMemory
1052539MercubytheFirst비스킷 담기 (IOI20_biscuits)C++17
9 / 100
64 ms432 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int K = 61, MX = 1e5 + 1;
long long count_tastiness(long long x, std::vector<long long> a) {
	if(x > MX) {
		return 1;
	}
	const int k = a.size();
	ll ans = 1;
	for(ll y = 1; y*x <= MX; ++y) {
		vector<long long> acpy = a;
		bool ok = true;
		for(int round = 0; round < x; ++round) {
			ll cur = y;
			for(int b = k - 1; b >= 0; --b) {
				int can_take = min(a[b], cur >> b);
				a[b] -= can_take;
				cur -= (can_take << b);
			}
			if(cur > 0) {
				ok = false;
				break;
			}
		}
		a = acpy;
		if(ok) {
			// cout << "counted " << y << endl;
			ans++;
		}
	}
	return ans;
}
#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...