제출 #831617

#제출 시각아이디문제언어결과실행 시간메모리
831617Dremix10비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1074 ms340 KiB
#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;

    ll i;
    for(i=0;i<n;i++){
        sum += (1ll<<i) * a[i];
    }

    ll ub = sum/x;

    ll ret = 1;
    for(i=1;i<=ub;i++){
        vector<ll> curr = a;
        bool ok = 1;
        for(ll j=n-1;j>=0;j--){
            if(((1ll<<j)&i)==false){
                continue;
            }
            ll 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...