이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Dgrader.cpp
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
using ll = long long;
using ld = long double;
#define all(x) begin(x), end(x)
#define sz(x) ((int) (x).size())
ll count_tastiness(ll x, vector<ll> k) {
if (x == 1) {
ll a = 1, b = 1, c = 0;
for (ll q : k) {
a += q;
if (a % 2) {
c += b;
}
a /= 2;
b *= 2;
if (a == 0) {
a = 1;
b = c;
c = 0;
}
}
return a * b + c;
} else {
ll total = 0;
for (int i = 0; i < sz(k); ++i) {
total += k[i] << i;
}
total /= x;
ll ans = 0;
auto ck = k;
for (ll req = 0; req <= total; ++req) {
ck = k;
bool possible = true;
for (int i = 0; i < x; ++i) {
ll curr = req;
for (int j = sz(ck); j--; ) {
ll cnt = min(ck[j], curr >> j);
curr -= cnt << j;
ck[j] -= cnt;
}
if (curr) {
possible = false;
break;
}
}
ans += possible;
}
return ans;
}
}
# | 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... |