#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int kx=30, nx=1e5+5;
long long count_tastiness(long long x, std::vector<long long> a) {
ll res=0;
vector<ll> c(kx);
for (int i=0; i<min(kx, (int)a.size()); i++) c[i]=a[i];
for (ll i=0; i<nx; i++)
{
if (i*x>nx) break;
bool f=0;
vector<ll> tmp(kx);
for (int j=0; j<20; j++) tmp[j]=c[j];
for (int j=0; j<x; j++)
{
ll cur=i, idx=20;
while (idx>=0&&cur>0)
{
if (!tmp[idx]||(1<<idx)>cur) --idx;
else if ((tmp[idx]*(1<<idx))<cur) cur-= tmp[idx]*(1<<idx), tmp[idx]=0;
else tmp[idx]-=(cur/(1<<idx)), cur=cur%(1<<idx);
//if (i==7) cout<<"here "<<idx<<' '<<cur<<'\n';
}
/*
if (i==7)
{
cout<<"cur "<<cur<<'\n';
cout<<"debug : ";
for (int k=0; k<4; k++) cout<<tmp[k]<<' ';
cout<<'\n';
}*/
if (cur!=0)
{
f=1;
break;
}
}
if (!f) res++;
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
1059 ms |
348 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
348 KB |
Output is correct |
2 |
Incorrect |
31 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
1059 ms |
348 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |