제출 #585793

#제출 시각아이디문제언어결과실행 시간메모리
585793LucaIlie비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1125 ms913664 KiB
#include "biscuits.h"
#include <bits/stdc++.h>

using namespace std;

long long count_tastiness( long long x, vector <long long> a ) {
    const int k = 60;
    long long s;
    vector <long long> dp[k];

    a.resize( k );

    s = 0;
    for ( int b = 0; b < k; b++ ) {
        a[b] += s;
        if ( a[b] > x ) {
            s = a[b] - x;
            a[b] = x + s % 2;
            s /= 2;
        } else
            s = 0;
    }

    dp[0].push_back( a[0] );
    if ( a[0] - x >= 0 )
        dp[0].push_back( a[0] - x );
    for ( int b = 1; b < k; b++ ) {
        for ( long long s: dp[b - 1] ) {
            dp[b].push_back( s / 2 + a[b] );
            if ( s / 2 + a[b] - x >= 0 )
                dp[b].push_back( s / 2 + a[b] - x );
        }
    }

    return dp[k - 1].size();
}
#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...