Submission #413134

#TimeUsernameProblemLanguageResultExecution timeMemory
413134atoizPacking Biscuits (IOI20_biscuits)C++14
9 / 100
1089 ms332 KiB
#include "biscuits.h"
#include <numeric>
#include <cstdio>

long long count_tastiness(long long x, std::vector<long long> a) {
	a.resize(20);
	long long res = 0;
	for (long long i = 0; i <= 100000; ++i) {
		long long c = 0, b = 1, p = i;
		for (long long j = 0; j < (long long) a.size(); ++j) {
			c += a[j];
			if ((p >> j) & 1) {
				p ^= 1 << j;
				c -= x;
				if (c < 0) b = 0;
			}
			// if (i == 8) fprintf(stderr, "%lld: %lld\n", j, c);
			c /= 2;
		}
		if (p) b = 0;
		res += b;
		// if (b) fprintf(stderr, "%df\n", i);
	}
	return res;
}

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