제출 #834584

#제출 시각아이디문제언어결과실행 시간메모리
834584Johann비스킷 담기 (IOI20_biscuits)C++14
0 / 100
1098 ms228328 KiB
#include "biscuits.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() ll X; long long count_tastiness(long long _X, std::vector<long long> a) { vi b; X = _X; for (int i = 0; i < sz(a); ++i) { b.push_back(a[i]); if (b[i] >= X) { ll remove = ((a[i] - X) / 2) * 2; b[i] -= remove; if (i + 1 < sz(a)) a.push_back(0); a[i + 1] += (remove) / 2; } } if (b.back() != 0) b.push_back(0); vvi dp(sz(b), vi(X + 2, 0)); // b.back() == 0 for (int j = 0; j < sz(dp.back()); ++j) dp.back()[j] = 1; dp.back()[X] = 2; dp.back()[X + 1] = 2; for (int i = sz(b) - 2; i >= 0; --i) { for (int j = 0; j < sz(dp[i]); ++j) { ll vorrat = b[i] + j; dp[i][j] += dp[i + 1][vorrat / 2]; // mache nichts if (vorrat >= X) dp[i][j] += dp[i + 1][(vorrat - X) / 2]; // set a bit } } return dp[0][0]; }
#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...