이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
typedef pair<ll,ll> pii;
const ll MAXN = 2e5+5;
const ll INF = 1e9+7;
long long count_tastiness(long long x, std::vector<long long> a) {
ll i,j,y,ans=1,k=(ll)a.size(),cur,sum=0;
ll p,bruh,rest;
bool ok;
for(i=0;i<k;i++){
cur=(ll)pow(2,i);
sum+=cur*a[i];
}
vector<ll>teste(k);
for(y=1;y<=sum;y++){//ver quantos sacos de y consigo
for(i=0;i<k;i++)teste[i]=a[i];
ok=true;
//cout<<y<<endl;
for(j=0;j<x;j++){//cout<<"saco "<<j<<endl;
rest=y;
for(i=k-1;i>=0;i--){if(rest==0)break;
bruh = (ll)pow(2,i);
if(bruh>rest)continue;
p = (rest/bruh);
ll z=min(teste[i],p);
teste[i]-=z;
rest-=z*bruh;
//cout<<i<<" "<<teste[i]<<" "<<p<<" "<<rest<<endl;
}
if(rest!=0){
ok=false;//cout<<y<<" bruh "<<j<<"\n";
//for(i=0;i<k;i++)cout<<teste[i]<<" ";
//cout<<endl;
break;
}
}
if(ok)ans++;
}
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... |