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>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define rep(x,s,e) for (auto x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
int num;
vector<ll> arr;
vector<ll> memo;
long long count_tastiness(long long N, std::vector<long long> ARR) {
num=N,arr=ARR;
ll mx;
memo={0};
rep(x,0,sz(arr)){
int temp=sz(memo);
mx=0;
rep(y,0,temp){
ll curr=memo[y]+arr[x];
if (curr>=num) memo.push_back((curr-num)>>1);
memo[y]=curr>>1;
mx=max(mx,memo[y]);
}
}
while (mx>=num){
int temp=sz(memo);
mx=0;
rep(y,0,temp){
if (memo[y]>=num) memo.push_back((memo[y]-num)>>1);
memo[y]>>=1;
mx=max(mx,memo[y]);
}
}
return sz(memo);
}
# | 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... |