#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
#define ll long long
// #define int ll
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
const ll maxn = 1e5+5;
const int bloc = 101;
long long count_tastiness(long long x, std::vector<long long> a) {
ll mxval = 0;
REP(i, SZ(a)){
mxval += (1ll<<i) * a[i];
}
ll cnt = 1;
REP1(i, mxval){
vector<ll> tmp = a;
bool gg = false;
REP(t, x){
ll cur = i, tod;
RREP(j, SZ(tmp)){
if ((1ll<<j) > cur || tmp[j] == 0) continue;
tod = min(cur / (1ll<<j), tmp[j]);
tmp[j] -= tod;
cur -= (1ll<<j) * tod;
}
if (cur != 0){
gg = 1;
break;
}
}
if (!gg) {
cnt++;
}
}
return cnt;
//return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |