제출 #432319

#제출 시각아이디문제언어결과실행 시간메모리
432319Mlxa비스킷 담기 (IOI20_biscuits)C++14
12 / 100
3 ms560 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mt make_tuple
#define x first
#define y second
#include "biscuits.h"

bool bit(ll m, int i) {
	return (m >> i) & 1;
}

ll count_tastiness(ll x, vector<ll> a) {
	assert(x == 1);
	ll full = 1, some = 0;
	a.resize(200, 0);
	for (int i = 0; i < 150; ++i) {
		ll carry = (a[i] - 1) / 2;
		a[i + 1] += carry;
		a[i] -= 2 * carry;
	}
	assert(*max_element(all(a)) <= 2);
	reverse(all(a));
	for (ll e : a) {
		if (e == 0) {
			full = full + some;
			some = 0;
		} else if (e == 1) {
			some = full + some * 2;
		} else {
			assert(e == 2);
			some = (full + some) * 2;
		}
	}
	return full + some;
}

#ifdef LC
#include "grader.cpp"
#endif
#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...