#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
typedef pair<ll,ll> pii;
const ll MAXN = 2e5+5;
const ll INF = 1e9+7;
long long count_tastiness(long long x, std::vector<long long> a) {
ll i,j,y,ans=1,k=(ll)a.size(),cur,sum=0;
ll p,bruh,rest;
bool ok;
for(i=0;i<k;i++){
cur=(ll)pow(2,i);
sum+=cur*a[i];
}
vector<ll>teste(k);
for(y=1;y<=sum;y++){//ver quantos sacos de y consigo
for(i=0;i<k;i++)teste[i]=a[i];
ok=true;
//cout<<y<<endl;
for(j=0;j<x;j++){//cout<<"saco "<<j<<endl;
rest=y;
for(i=k-1;i>=0;i--){if(rest==0)break;
bruh = (ll)pow(2,i);
if(bruh>rest)continue;
p = (rest/bruh);
ll z=min(teste[i],p);
teste[i]-=z;
rest-=z*bruh;
//cout<<i<<" "<<teste[i]<<" "<<p<<" "<<rest<<endl;
}
if(rest!=0){
ok=false;//cout<<y<<" bruh "<<j<<"\n";
//for(i=0;i<k;i++)cout<<teste[i]<<" ";
//cout<<endl;
break;
}
}
if(ok)ans++;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
1087 ms |
204 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
1082 ms |
204 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
1087 ms |
204 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |