Submission #604816

#TimeUsernameProblemLanguageResultExecution timeMemory
604816gagik_2007비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1090 ms340 KiB
#include "biscuits.h"
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <limits>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef ll itn;

#define ff first
#define ss second

ll n;

ll count_tastiness(ll x, vector<ll> a) {
	n = a.size();
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i] * (1ll << i);
	}
	sum /= x;
	ll ans = 0;
	for (int y = 0; y <= sum; y++) {
		vector<ll>c = a;
		bool ys = true;
		for (int i = 0; i < x; i++) {
			ll val = y;
			for (int j = n - 1; j >= 0; j--) {
				ll cnt = val / (1ll << j);
				ll v = min(cnt, c[j]);
				c[j] -= v;
				val -= v * (1ll << j);
			}
			if (val != 0) {
				ys = false;
				break;
			}
		}
		ans += ys;
	}
	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...