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;
typedef long long lo;
typedef pair< lo,lo > PII;
#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
int n,m,b[li],a[li],k,flag,t;
lo cev,cnt[li];
string s;
long long count_tastiness(long long x, std::vector<long long> v) {
k=(int)v.size();
cev=0;
for(int i=0;i<=200000;i++){
lo tut=i;
for(int j=k-1;j>=0;j--){
lo at=tut/(1ll<<j);
at=min(at,v[j]);
tut-=at*(1ll<<j);
cnt[j]=at;
}
if(tut)continue;
tut=0;
for(int j=k-1;j>=0;j--){
tut+=cnt[j]*x;
if(tut>=1000000000)break;
tut-=v[j];
tut=max(tut,0ll);
tut*=2;
}
if(tut)continue;
//~ cout<<i<<endl;
cev++;
}
//~ cout<<endl;
return cev;
}
# | 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... |