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;
if (x>100005) return 1;
ll ans = 0;
FOR(req,0,100005/x + 2){
a = temp;
bool flag = false;
ll cnt = 0;
FOR(k,0,x){
ll sus = 0;
FORNEG(i,a.size()-1, -1){
ll mini = min((req-sus)/(1<<i), a[i]);
a[i] -= mini;
sus += mini * (1<<i);
}
if (sus != req){
flag = true;
break;
}
}
if (!flag)ans++;
}
return ans;
}
Compilation message (stderr)
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:25:6: warning: unused variable 'cnt' [-Wunused-variable]
25 | ll cnt = 0;
| ^~~
# | 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... |