제출 #615944

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

using namespace std;

#define vi vector<int>
#define int long long
#define pb push_back
#define ins insert
#define sz(x) (int)((x).size())

const int siz = 1e5+40;

long long count_tastiness(long long x, std::vector<long long> b) {
	while (sz(b) < 61) b.push_back(0);
	int dp [61][siz];
    for (int i = 0; i < siz; i++) dp[61-1][i] = 1;
    for (int i = 61-2; i >= 0; i--) for (int j = 0; j < siz; j++) {
        int newJ = j+b[i];
        dp[i][j] = dp[i+1][min(siz-1, newJ/2LL)];
        if (newJ >= x) {
            newJ -= x;
            newJ /= 2LL;
            dp[i][j] += dp[i+1][min(siz-1, newJ)];
        }
    }
    int res = dp[0][0];
    return res;
}
#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...