Submission #390689

# Submission time Handle Problem Language Result Execution time Memory
390689 2021-04-16T14:06:22 Z AdOjis485 Packing Biscuits (IOI20_biscuits) C++17
0 / 100
1000 ms 332 KB
#include "biscuits.h"
#include <iostream>
#define int long long
using namespace std;


int count_tastiness(int x, vector<int> a) 
{
	int ans = 0;
	for(int i = 0; i <= 1e6; i ++)
	{
		vector<int> a2 = a;
		bool poss = true;
		int i2 = i;
		int j = 0;
		while(i2 > 0)
		{
			if(i2 % 2 == 1)
			{
				if(a2[j] < x)
				{
					poss = false;
					break;
				}
				a2[j] -= x;
			}
			if(j + 1 == a2.size()) a2.push_back(0);
			a2[j + 1] += a2[j] / 2;	
			i2 /= 2;
			j ++;
		}
		ans += poss;
	}
	return ans;
}

Compilation message

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:27:13: 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]
   27 |    if(j + 1 == a2.size()) a2.push_back(0);
      |       ~~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -