72272024-01-03 19:48:10MagyarKendeSZLGTakaros Sorozat (80 pont)cpp17Wrong answer 32/806ms4292 KiB
#include <bits/stdc++.h>

#define speed cin.tie(0); ios::sync_with_stdio(0)
#define cinv(v) for (auto& e : v) cin >> e;
#define all(v) v.begin(), v.end()
#define has(s, e) s.count(e)

using namespace std;
using ll = long long;
using point = array<int, 2>;

int main() {
    speed;

    int N;
    cin >> N;
    vector<bool> v;

    bool start = 0;
    while (N--) {
        char c;
        cin >> c;
        start |= c == '1';
        if (start) {
            v.push_back(c == '1');
        }
    }

    N = v.size();

    int result = 0;
    auto p1v = v;

    for (int i = 0; i < N; i++) {
        if (!p1v[i]) {
            result++;
            if (i + 1 < N) p1v[i + 1] = 1;
        }
    }

    cout << result << '\n';

    result = 0;
    for (int i = 0; i < N; i++) {
        if (!v[i]) {
            result++;
            for (int j = i + 1; j < N && j < i + 4; j++) {
                v[j] = 1;
            }
        }
    }

    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base32/80
1Accepted0/03ms1828 KiB
2Wrong answer0/06ms2184 KiB
3Accepted4/43ms2332 KiB
4Accepted4/43ms2552 KiB
5Accepted4/43ms2768 KiB
6Partially correct2/43ms2984 KiB
7Partially correct2/43ms3212 KiB
8Partially correct2/42ms3288 KiB
9Partially correct2/42ms3384 KiB
10Wrong answer0/43ms3520 KiB
11Partially correct2/43ms3640 KiB
12Wrong answer0/43ms3728 KiB
13Accepted4/44ms4012 KiB
14Wrong answer0/44ms4092 KiB
15Accepted4/44ms4100 KiB
16Partially correct2/44ms4032 KiB
17Wrong answer0/44ms4016 KiB
18Wrong answer0/44ms4036 KiB
19Wrong answer0/44ms4292 KiB
20Wrong answer0/44ms4248 KiB
21Wrong answer0/44ms4248 KiB
22Wrong answer0/44ms4244 KiB