이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
const int N = 3e5+5;
const int MOD = 1e9+7;
const ll INF = 1e18+5;
#ifdef dremix
#define p2(x,y) cerr<<#x<<", "<<#y<<" = "<<x<<", "<<y<<endl;
#define ppv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v.F<<"-"<<v.S<<", ";cerr<<"}"<<endl;
#define pv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v<<", ";cerr<<endl;
#else
#define p2(x,y) {}
#define ppv(x) {}
#define pv(x) {}
#endif
long long count_tastiness(long long x, std::vector<long long> a) {
int n = a.size();
ll sum = 0;
int i;
for(i=0;i<n;i++){
sum += (1<<i) * a[i];
}
ll ub = sum/x;
ll ret = 1;
for(i=1;i<=ub;i++){
vector<ll> curr = a;
bool ok = 1;
for(int j=n-1;j>=0;j--){
if(((1<<j)&i)==false){
continue;
}
int k = j;
ll need = x;
while(need > 0 && k >= 0){
ll temp = min(need,curr[k]);
need -= temp;
curr[k] -= temp;
need *= 2;
k--;
}
if(need > 0){
ok = 0;
}
}
p2(i,ok)
ret += ok;
}
return ret;
}
# | 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... |