(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 #329405

#TimeUsernameProblemLanguageResultExecution timeMemory
329405chenwzPacking Biscuits (IOI20_biscuits)C++14
100 / 100
13 ms1388 KiB
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int KK = 60; LL count_tastiness(LL x, vector<LL> a) { while (a.size() < KK) 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...