제출 #385036

#제출 시각아이디문제언어결과실행 시간메모리
385036rqi비스킷 담기 (IOI20_biscuits)C++14
9 / 100
1088 ms492 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;

#define sz(x) (int)(x).size()
#define pb push_back

int k;
vl a;
ll x;

ll tpow[60];

bool possible(ll y){
	vl A = a;
	
	for(int i = 0; i <= 59; i++){
		if((y>>i)&1){
			A[i]-=x;
		}
		
		if(A[i] < 0) return 0;
		if(i+1 < 60){
			A[i+1]+=A[i]/2;
		}
	}
	//cout << y << "\n";
	return 1;
}

ll solveCase1(){
	while(sz(a) < 60){
		a.pb(0);
	}
	int ans = 0;
	for(int y = 0; y <= 100000; y++){
		if(possible(y)){
			ans++;
		}
	}
	return ans;
}

ll count_tastiness(ll _x, vl _a) {
	x = _x;
	a = _a;

	k = sz(a);

	tpow[0] = 1;
	for(int i = 1; i <= 59; i++){
		tpow[i] = tpow[i-1]*2;
	}

	bool CASE1 = 1;

	if(CASE1){
		return solveCase1();
	}

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