Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using i32 = int32_t;
- using ui32 = uint32_t;
- using i64 = int64_t;
- using ui64 = uint64_t;
- using namespace std;
- i32 main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- int x, n;
- cin >> x >> n;
- vector<int> arr(n);
- for (int i = 0; i < n; i++) cin >> arr[i];
- int ans = 0;
- while (arr.size()) {
- while (arr.size() && arr.back() == 0) arr.pop_back();
- if (arr.size()) {
- int cur = x;
- while (cur-- && arr.size()) arr.pop_back();
- ans++;
- }
- }
- cout << ans << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement