Submission #416452

#TimeUsernameProblemLanguageResultExecution timeMemory
416452SuhaibSawalha1Packing Biscuits (IOI20_biscuits)C++17
9 / 100
1074 ms324 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

long long count_tastiness(long long x, vector<long long> a) {
	long long ans = 0;
	for (int i = 0; i <= 100000; ++i) {
		long long hv = 0;
		bool ok = 1;
		for (int j = 0; j < 20; ++j) {
			hv /= 2;
			if (j < a.size()) {
				hv += a[j];
			}
			if (i >> j & 1) {
				if (hv >= x) {
					hv -= x;
				}
				else {
					ok = 0;
					break;
				}
			}
		}
		ans += ok;
	}
	return ans;
}

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:12:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |    if (j < a.size()) {
      |        ~~^~~~~~~~~~
#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...