This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool check(ll y, ll x, vector<ll> a)
{
/// can I form the number y x times???
int n = (int) a.size();
if (log2(y) >= n)
{
return 0;
}
ll have = 0;
ll need = 0;
for (int i = 0; i < n; i++)
{
have += a[i] * (1LL << i);
if (y & (1LL << i))
{
need += x * (1LL << i);
}
if (have < need)
{
return 0;
}
}
return 1;
}
ll count_tastiness(ll x, vector<ll> a)
{
ll sol = 0;
for (ll y = 0; y <= (ll) 5e5; y++)
{
sol += check(y, x, a);
}
return sol;
}
# | 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... |