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 "biscuits.h"
#include <iostream>
using namespace std;
long long count_tastiness(long long x, std::vector<long long> a) {
int s = 0,k = a.size();
for(int i = 0; i < k; i++) s += a[i] * (1<<i);
int ans = 1;
for(int i = 1; i <= s/x; i++){
vector<long long> b = a;
bool go = true;
for(int j = 0; j < 20; j++){
if(i&(1<<j)){
for(int _ = 0; _ < x; _++){
int c = j, cant = 1;
if(c >= k){
go= false;
break;
}
while(b[c] < cant){
b[c] = 0;
cant -= b[c];
cant *= 2;
c--;
}
if(c==-1) {
go = false;
break;
}
b[c] -= cant;
}
}
}
if(go) {
ans++;
}
}
return ans;
}
# | 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... |