Submission #581729

#TimeUsernameProblemLanguageResultExecution timeMemory
581729joelauPacking Biscuits (IOI20_biscuits)C++14
9 / 100
82 ms340 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

vector<long long> A;

long long count_tastiness(long long x, vector<long long> a) {
	while (a.size() < 20) a.push_back(0);
	long long ans = 0;
	for (long long i = 0; i*x <= 100000; ++i) {
		A = a;
		bool can = true;
		for (long long j = 0; j < A.size() && can; ++j) {
			if (i & (1ll<<j)) {
				if (A[j] >= x) A[j] -= x;
				else can = false;
			}
			if (j != A.size()-1) A[j+1] += A[j]/2;
		}
		if (can) ans++;
	}
	return ans;
}

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:13:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |   for (long long j = 0; j < A.size() && can; ++j) {
      |                         ~~^~~~~~~~~~
biscuits.cpp:18:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |    if (j != A.size()-1) A[j+1] += A[j]/2;
      |        ~~^~~~~~~~~~~~~
#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...