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 <bits/stdc++.h>
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
using namespace std;
long long count_tastiness(long long x, std::vector<long long> a) {
vector<ll> temp = a;
ll ans = 0;
FOR(req,0,100005/x + 2){
a = temp;
bool flag = false;
FOR(k,0,x){
ll sus = 0;
FORNEG(i,a.size()-1, -1){
while (sus + (1<<i) <= req && a[i]) sus += (1<<i), a[i]--;
}
if (sus != req){
flag = true;
break;
}
}
if (!flag)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... |