Submission #675722

#TimeUsernameProblemLanguageResultExecution timeMemory
675722VodkaInTheJarPacking Biscuits (IOI20_biscuits)C++14
21 / 100
1092 ms24708 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3") #define endl '\n' using namespace std; long long count_tastiness(long long x, vector <long long> a) { map <long long, long long> mp; mp[0]++; int sz = (int)a.size(); for (int i = 0; ; i++) { map <long long, long long> new_mp; long long to_add = (i < sz ? a[i] : 0); for (auto j: mp) new_mp[(j.first >> 1ll) + to_add] += j.second; mp = new_mp; bool is = false; for (auto it = prev(new_mp.end()); it->first >= x; it--) { is = true; mp[it->first - x] += it->second; if (it == new_mp.begin()) break; } if (!is && i >= sz) break; } long long ans = 0; for (auto i: mp) ans += i.second; return ans; } /* int main() { long long x, n; cin >> x >> n; vector <long long> a(n); for (int i = 0; i < n; i++) cin >> a[i]; cout << count_tastiness(x, a) << endl; } */
#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...