제출 #362584

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

using namespace std; 

typedef long long ll;

ll count_tastiness(ll x, vector<ll> a) {
    const int k = 60;
    while ((int)a.size() < k + 1) a.push_back(0LL);
    ll res = 0;
    for (ll y = 0; y <= 100000; y++) {
        auto a_copy = a;
        bool can = true;
        for (int i = 0; i < k; i++) {
            ll need = x * ((y >> i) & 1);
            if (a[i] < need) {
                can = false;
                break;
            }
            a[i] -= need;
            a[i + 1] += a[i] / 2;
        }
        if (can) res++;
        a = a_copy;
    }
    return res;
}

#ifdef LOCAL
int main() {
    freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k;
    ll x;
    cin >> k >> x;
    vector<ll> a(k);
    for (ll &z : a) cin >> z;
    cout << count_tastiness(x, a);
    return 0;
}
#endif
#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...