#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long x,sum,curr,mult;
int k,ans;
vector<long long> br;
bool dali;
long long count_tastiness(long long X,vector<long long> A){
k=int(A.size()); x=X;
br.resize(k); ans=0;
for(int i=0;i<=100000/x;i++){
for(int f=0;f<k;f++)br[f]=A[f];
dali=true;
for(int f=0;f<x;f++){
curr=i;
for(int t=k-1;t>=0;t--){
mult=min(curr/(1LL<<t),br[t]);
curr-=mult*(1LL<<t); br[t]-=mult;
}
if(curr!=0)dali=false;
}
if(dali)ans++;
}
return ans;
}
/*
int main(){
cout<<count_tastiness(2, {2, 1, 2})<<"\n";
cout<<count_tastiness(2, {2, 1, 2})<<"\n";
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
1082 ms |
212 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
212 KB |
Output is correct |
2 |
Incorrect |
88 ms |
280 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
162 ms |
284 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1056 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
1082 ms |
212 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |