제출 #1032297

#제출 시각아이디문제언어결과실행 시간메모리
1032297mdn2002Packing Biscuits (IOI20_biscuits)C++17
42 / 100
1035 ms40556 KiB
/*
Mayoeba Yabureru
*/
#include<bits/stdc++.h>
using namespace std;

long long count_tastiness(long long x, vector<long long> a) {
    while (a.size() != 200) a.push_back(0);
    a.insert(a.begin(), 0);
    vector<vector<pair<long long, long long>>> dp(202);
    dp[0].push_back({0, 1});
    long long ans = 0;
    for (int i = 1; i <= 150; i ++) {
        if (i > 60 && dp[i - 1].size() == 0 && dp[i - 1][0].first == 0) break;
        map<long long, long long> dpp;
        for (auto [aa, y] : dp[i - 1]) {
            dpp[aa / 2 + a[i]] += y;
            if (aa / 2 + a[i] >= x) dpp[aa / 2 + a[i] - x] += y;
        }
        for (auto x : dpp) dp[i].push_back(x);
        ans = dp[i][0].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...