Submission #390682

# Submission time Handle Problem Language Result Execution time Memory
390682 2021-04-16T13:57:03 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 ++)
	{
		bool poss = true;
		int i2 = i;
		int j = 0;
		while(i2 > 0)
		{
			if(i2 % 2 == 1)
			{
				if(j >= a.size() || a[j] < x)
				{
					poss = false;
					break;
				}
				a[j] -= x;
			}
			if(j + 1 == a.size()) a.push_back(0);
			a[j + 1] += a[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:19: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]
   19 |     if(j >= a.size() || a[j] < x)
      |        ~~^~~~~~~~~~~
biscuits.cpp:26: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]
   26 |    if(j + 1 == a.size()) a.push_back(0);
      |       ~~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 118 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 179 ms 272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 118 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -