#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 |
1 |
Incorrect |
389 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
394 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
460 ms |
368 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
389 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |