(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #479157

#TimeUsernameProblemLanguageResultExecution timeMemory
479157khoabrightPacking Biscuits (IOI20_biscuits)C++17
100 / 100
15 ms1228 KiB
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pii pair<int, int> #define all(x) x.begin(), x.end() #define rep(i, a, b) for (int i = (int)a; i <= (int)b; ++i) #define rep1(i, a, b) for (int i = (int)a; i >= (int)b; --i) #define mp make_pair #define vii vector<vector<int>> #define ll long long // void count_tastiness(int64_t x, vector<int64_t> a) { // int k = a.size(); // rep(i, 0, k - 1) { // if (a[i] > 2) { // } // } // } long long count_tastiness(long long x, vector<long long> a) { while (a.size() < 60) a.push_back(0); vector<long long> b; for (long long i: a) b.push_back(i); for (int i = 1; i < 60; ++i) b[i] += b[i - 1] / 2; long long dp[61]; dp[0] = 1; for (int i = 0; i < 60; ++i) { if (b[i] < x) { dp[i + 1] = dp[i]; continue; } long long dpv = 0, k = max(0LL, x - a[i]) * 2; for (int j = i; j > 0; --j) { if (b[j - 1] >= k + x) dpv += dp[j - 1], k = max(0LL, k + x - a[j - 1]) * 2; else k = max(0LL, k - a[j - 1]) * 2; } if (k == 0) ++dpv; dp[i + 1] = dp[i] + dpv; } return dp[60]; }
#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...