Submission #675721

#TimeUsernameProblemLanguageResultExecution timeMemory
675721VodkaInTheJarPacking Biscuits (IOI20_biscuits)C++14
9 / 100
1095 ms24584 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, int> mp; mp[0]++; int sz = (int)a.size(); for (int i = 0; ; i++) { map <long long, int> 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; } int 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...