#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 |
1 |
Correct |
2 ms |
1528 KB |
Output is correct |
2 |
Execution timed out |
1082 ms |
556184 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1528 KB |
Output is correct |
2 |
Execution timed out |
1123 ms |
597496 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1137 ms |
673416 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
715 ms |
2556 KB |
Output is correct |
2 |
Execution timed out |
1057 ms |
3060 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1528 KB |
Output is correct |
2 |
Execution timed out |
1082 ms |
556184 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |