Submission #1051710

#TimeUsernameProblemLanguageResultExecution timeMemory
1051710aykhn비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1039 ms436 KiB
#include "biscuits.h"
#include <bits/stdc++.h>

using namespace std;

long long x, k;
vector<long long> a, pre;

long long count_tastiness(long long X, vector<long long> A) 
{
	x = X, a = A, k = A.size();
	long long res = 0, S = 0;
	for (int i = 0; i < k; i++) S += (a[i] << i);
	for (long long y = 0; y <= 100000; y++)
	{
		a = A;
		if (x * y > S) break;
		int s = 0, f = 1;
		for (long long j = 0; j < 60; j++)
		{
			if (j < k) s += a[j] << j;
			if ((y >> j & 1)) 
			{
				if ((x << j) > s)
				{
					f = 0;
					break;
				}
				s -= (x << j);
			}
		}
		res += f;
	}
	return res;
}

#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...