제출 #1035661

#제출 시각아이디문제언어결과실행 시간메모리
1035661Mr_Husanboy비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1092 ms444 KiB
#include "biscuits.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second

template<typename T>
int len(T &a){return a.size();}

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

vector<ll> cnt;
ll x;

map<pair<int,ll>,ll> mp;

ll count(int i, ll j){
	if(i == 63){
		return j >= 0;
	}
	if(mp.count({i, j})) return mp[{i, j}];

	j += cnt[i];
	ll res = 0;
	if(j >= x){
		res += count(i + 1, (j - x) / 2);
	}
	res += count(i + 1, j / 2);
	return res;
}

long long count_tastiness(long long X, vector<long long> A) {
	cnt = A;
	x = X;
	while(len(cnt) < 63){
		cnt.push_back(0);
	}
	return count(0, 0);
}

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