Submission #834613

#TimeUsernameProblemLanguageResultExecution timeMemory
834613JohannPacking Biscuits (IOI20_biscuits)C++14
0 / 100
1 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() ll X; long long count_tastiness(long long _X, std::vector<long long> a) { for (int i = 0; i < sz(a); ++i) { if (a[i] >= 3) { if (i + 1 < sz(a)) a.push_back(0); if (a[i] & 1) a[i + 1] += a[i] / 2, a[i] = 1; else if (a[i] > 0) a[i + 1] += a[i] / 2 - 1, a[i] = 2; } } a.push_back(0); ll ans = 1; ll base = 1; ll tmp = 1; for (int i = 0; i < sz(a); ++i) { if (a[i] == 0) { ans *= tmp; tmp = 1; base = 1; } else { tmp += base * a[i]; base *= 2; } } 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...