제출 #1168919

#제출 시각아이디문제언어결과실행 시간메모리
1168919MateiKing80비스킷 담기 (IOI20_biscuits)C++20
100 / 100
10 ms840 KiB
#include <iostream>
#include <vector>
#include "biscuits.h"

using namespace std;

typedef long long ll;
#define int ll

int ways[63];
int ct[63];

int count_tastiness(int x, vector<int> a)
{
	int tot = 0;
	ways[0] = 1;
	a.resize(64);
	
	for(int i = 0; i < 62; i ++)
	{
		int way = 0;
		tot += a[i] * (1ll << i);
		ct[i] = tot;
		int tot2 = tot;
		for(int j = i; j >= 0; j --)
		{
			tot2 = min(tot2, ct[j]);
			if((1ll << 62) / x >= (1ll << j) && tot2 >= x * (1ll << j))
				tot2 -= x * (1ll << j), 
				way += ways[j];
		}
		ways[i + 1] = way + 1;
	}
	
	return ways[62];
}
#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...