이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include <iostream>
#define ll long long
#define ff first
#define ss second
#define ln "\n"
#define pll pair<ll, ll>
using namespace std;
long long count_tastiness_check(long long x, vector<long long> _a) {
vector<ll> a=_a;
a.resize(61);
ll k=60;
ll ans=0;
for (ll i=0; i<=100000/x; i++){
vector<ll> an=a;
bool pos=1;
for (ll j=0; j<k; j++){
if ((1ll<<j)&i){
if (an[j]>=x){
an[j+1]+=(an[j]-x)/2;
}else{
pos=0;
}
}else{
an[j+1]+=an[j]/2;
}
}
if (pos) {
// cout << i << " ";
ans++;
}
}
// cout << ln;
return ans;
}
long long count_tastiness(long long x, vector<long long> _a) {
vector<ll> a=_a;
a.resize(61);
ll k=60;
ll ans=1;
for (ll i=0; i<k; i++){
if (a[i]>1){
a[i+1]+=a[i]/2;
a[i]%=2;
}
ans+=a[i]*(1ll<<i);
}
ans+=a[60]*(1ll<<60);
// if (ans!=count_tastiness_check(x, _a)){
// cout << "ERROR -> " << count_tastiness_check(x, _a) << ln;
// }
return ans;
}
# | 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... |