이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long x,sum,curr,mult;
int k,ans;
vector<long long> br;
bool dali;
long long count_tastiness(long long X,vector<long long> A){
k=int(A.size()); x=X;
br.resize(k); ans=0;
for(int i=0;i<=100000/x;i++){
for(int f=0;f<k;f++)br[f]=A[f];
dali=true;
for(int f=0;f<x;f++){
curr=i;
for(int t=k-1;t>=0;t--){
mult=min(curr/(1LL<<t),br[t]);
curr-=mult*(1LL<<t); br[t]-=mult;
}
if(curr!=0)dali=false;
}
if(dali)ans++;
}
return ans;
}
/*
int main(){
cout<<count_tastiness(2, {2, 1, 2})<<"\n";
cout<<count_tastiness(2, {2, 1, 2})<<"\n";
}
*/
# | 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... |