Submission #834136

#TimeUsernameProblemLanguageResultExecution timeMemory
834136JohannPacking Biscuits (IOI20_biscuits)C++14
9 / 100
1080 ms340 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() const ll bound = 2 * 1e18; ll X; ll ans = 0; vi A; void check(int idx, ll force) { assert(force <= bound); if (idx >= sz(A) && force <= 0) return; if (force >= X) { ++ans; ll nforce = (force - X) / 2; if (idx + 1 < sz(A)) nforce += A[idx + 1]; check(idx + 1, nforce); } force /= 2; if (idx + 1 < sz(A)) force += A[idx + 1]; check(idx + 1, force); } long long count_tastiness(long long _X, std::vector<long long> a) { X = _X; ans = 1; A = vi(all(a)); check(0, A[0]); return ans; }
#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...