제출 #529353

#제출 시각아이디문제언어결과실행 시간메모리
529353PurpleCrayon비스킷 담기 (IOI20_biscuits)C++17
0 / 100
2 ms588 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

#define sz(v) int(v.size())
typedef long long ll;

long long count_tastiness(long long x, std::vector<long long> a) {
    int k = sz(a);
    assert(x <= int(1e4));
    map<ll, ll> dp;
    dp[0] = 1;
    for (int i = 0; i < k; i++) {
        map<ll, ll> ndp;
        for (auto& [k, v] : dp) {
            // place a 0
            ndp[(a[i] + k) / 2] += v;
            // place a 1
            if (a[i] + k >= x)
                ndp[(a[i] + k - x) / 2] += v;
        }
        dp = ndp;
    }
    ll ans = 0;
    for (auto& [k, v] : dp)
        ans += v;

    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...