#include "biscuits.h"
/*
Author of all code: Pedro BIGMAN Dias
Last edit: 15/02/2021
*/
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include <cstring>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 500000000LL
#define EPS 0.00000001
#define pi 3.14159
ll mod=1000000007LL;
template<class A=ll>
void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;}
template<class A=ll>
void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}}
ll count_tastiness(long long x, vector<ll> a)
{
while(a.size()<60) {a.pb(0LL);}
ll ans=0LL; ll total=100000LL;
vector<ll> needed; vector<ll> ava; REP(i,0,60) {needed.pb(0LL); ava.pb(0LL);}
for(ll y = total/x; y>=0LL; y--)
{
REP(i,0,60) {needed[i]=0LL; ava[i]=a[i];}
ll z = y;
REP(i,0,60) {if(z%2LL!=0LL) {needed[i]+=x;} z=z/2LL;}
ll deficit;
bool ok=true;
for(ll pos = 59;pos>=0;pos--)
{
if(ava[pos]>=needed[pos]) {continue;}
if(pos==0) {ok=false; break;}
deficit = needed[pos]-ava[pos]; needed[pos-1]+=(2LL*deficit);
}
if(ok) {ans++;}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
265 ms |
372 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
8 ms |
364 KB |
Output is correct |
4 |
Correct |
132 ms |
364 KB |
Output is correct |
5 |
Correct |
138 ms |
492 KB |
Output is correct |
6 |
Correct |
128 ms |
492 KB |
Output is correct |
7 |
Correct |
154 ms |
396 KB |
Output is correct |
8 |
Correct |
125 ms |
364 KB |
Output is correct |
9 |
Correct |
147 ms |
492 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
70 ms |
376 KB |
Output is correct |
13 |
Correct |
31 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
264 ms |
492 KB |
Output is correct |
2 |
Incorrect |
158 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
265 ms |
372 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
8 ms |
364 KB |
Output is correct |
4 |
Correct |
132 ms |
364 KB |
Output is correct |
5 |
Correct |
138 ms |
492 KB |
Output is correct |
6 |
Correct |
128 ms |
492 KB |
Output is correct |
7 |
Correct |
154 ms |
396 KB |
Output is correct |
8 |
Correct |
125 ms |
364 KB |
Output is correct |
9 |
Correct |
147 ms |
492 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
70 ms |
376 KB |
Output is correct |
13 |
Correct |
31 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
364 KB |
Output is correct |
15 |
Correct |
264 ms |
492 KB |
Output is correct |
16 |
Incorrect |
158 ms |
364 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |