이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include <bits/stdc++.h>
#define int long long
using namespace std;
long long count_tastiness(long long x, std::vector<long long> a) {
long long res=0;
int k=(int)a.size();
for(int i=0;i<=200000;i++){
if(i>=(1<<k)){
continue;
}
int b[k];
for(int j=0;j<k;j++){
b[j]=a[j];
if(j && (i&(1<<(j-1)))==0){
b[j]+=b[j-1]/2;
b[j-1]=0;
}
}
bool ok=true;
for(int j=0;j<k;j++){
if(j){
b[j]+=b[j-1]/2;
}
if((i&(1<<j))){
b[j]-=x;
}
if(b[j]<0){
ok=false;
break;
}
}
if(ok){
res++;
}
}
return res;
}
# | 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... |