제출 #1214353

#제출 시각아이디문제언어결과실행 시간메모리
1214353thangdz2k7비스킷 담기 (IOI20_biscuits)C++20
42 / 100
1096 ms21384 KiB
#include "biscuits.h"
#include <bits/stdc++.h>

using namespace std;

long long count_tastiness(long long x, vector <long long> a){
    int k = a.size();
    while (k < 60){
        k ++;
        a.push_back(0);
    }

    unordered_map <long long, long long> dp;
    dp[0] = 1;
    for (int i = 0; i < k; ++ i){
        unordered_map <long long, long long> new_dp;
        for (auto tmp : dp){
            for (long long choose : {0ll, x}) if (tmp.first + a[i] >= choose){
                long long remains = (tmp.first + a[i] - choose) / 2;
                new_dp[remains] += tmp.second;
            }
        }

        swap(dp, new_dp);
    }

    long long ans = 0;
    for (auto tmp : dp) ans += tmp.second;

    return ans;
}
#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...