Submission #392178

# Submission time Handle Problem Language Result Execution time Memory
392178 2021-04-20T15:28:27 Z johutha Packing Biscuits (IOI20_biscuits) C++17
0 / 100
6 ms 392 KB
#include "biscuits.h"
#include <iostream>

#define int long long

using namespace std;

int count_tastiness(int x, vector<int> a)
{
	vector<int> pref(63);
	vector<int> dp(62);
	a.resize(64);

	int v = 0;
	int pw = 1;

	for (int i = 0; i < 62; i++, pw *= 2)
	{
		v += a[i]*pw;
		int b = v - pw*x;
		int np = pw / 2;

		for (int j = i - 1; j >= 0; j--, np /= 2)
		{
			if (b >= np*x)
			{
				b -= np*x;
				dp[i] += 1 + pref[j];
			}
		}
		if (b >= 0) dp[i]++;

		pref[i + 1] = pref[i] + dp[i];
	}

	return pref.back() + 1;
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -