제출 #1035175

#제출 시각아이디문제언어결과실행 시간메모리
1035175Gray비스킷 담기 (IOI20_biscuits)C++17
9 / 100
134 ms600 KiB
#include "biscuits.h"
#include <iostream>

#define ll long long
#define ff first
#define ss second
#define ln "\n"
#define pll pair<ll, ll>

using namespace std;

long long count_tastiness(long long x, vector<long long> _a) {
	vector<ll> a=_a;
	a.resize(61);
	ll k=60;

	ll ans=0;
	for (ll i=0; i<=100000/x; i++){
		vector<ll> an=a;
		bool pos=1;
		for (ll j=0; j<k; j++){
			if ((1ll<<j)&i){
				if (an[j]>=x){
					an[j+1]+=(an[j]-x)/2;
				}else{
					pos=0;
				}
			}else{
				an[j+1]+=an[j]/2;
			}
		}
		if (pos) {
			// cout << i << " ";
			ans++;
		}
	}
	// cout << ln;
	return ans;
}

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