이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include <vector>
using namespace std;
//x = number of people (p)
//y = tastiness of each bag (i)
long long count_tastiness(long long x, vector<long long> a)
{
int k = a.size();
long long ans = 0;
long long a_sum = 0;
for(int i = 0; i < k; i++)
a_sum += a[i] * (1 << i);
if(x > a_sum) return 1;
for(long long y = 0; x*y <= a_sum; y++)
{
vector<long long> value(x, 0);
vector<long long> A = a;
for(int i = k-1; i >= 0; i--)
{
for(int p = 0; p < x; p++)
{
while(A[i] > 0 && value[p] + (1 << i) <= y)
{
value[p] += (1 << i);
A[i]--;
}
}
}
bool good = 1;
for(int p = 0; p < x; p++)
if(value[p] != y)
good = 0;
if(good)
ans++;
}
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... |