Submission #432339

#TimeUsernameProblemLanguageResultExecution timeMemory
432339MlxaPacking Biscuits (IOI20_biscuits)C++14
0 / 100
1 ms588 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(x) x.begin(), x.end() #define mp make_pair #define mt make_tuple #define x first #define y second #include "biscuits.h" bool bit(ll m, int i) { return (m >> i) & 1; } ll count_tastiness(ll x, vector<ll> a) { assert(x == 1); ll debt = 1, good = 1; a.resize(200, 0); for (int i = 0; i < 150; ++i) { ll carry = (a[i] - 1) / 2; a[i + 1] += carry; a[i] -= 2 * carry; } assert(*max_element(all(a)) <= 2); reverse(all(a)); for (ll e : a) { if (e == 0) { debt = good; } else if (e == 1) { good *= 2; } else { assert(e == 2); ll was = good; good = 2 * good + debt; debt = was; } } return good; } #ifdef LC #include "grader.cpp" #endif
#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...