70732023-12-29 18:07:48MagyarKendeSZLGTakaros Sorozat (80 pont)cpp17Wrong answer 10/806ms4804 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 N;
vector<bool> B;

int first_one() {
    for (int i = 0; i < N; i++) {
        if (B[i]) return i;
    }
    return -1;
}

int main() {
    speed;

    cin >> N;
    B.resize(N);
    for (int i = 0; i < N; i++) {
        char c;
        cin >> c;
        B[i] = c == '1';
    }

    int fo = first_one();
    if (fo <= 0) {
        cout << "0\n0";
        exit(0);
    }

    int len = N - fo - 1, p2 = len / 4;
    cout << len / 2 + (len & 1) << '\n' << len / 4 + (len % 4) / 2 + ((len % 4) & 1);
}
SubtaskSumTestVerdictTimeMemory
base10/80
1Accepted0/03ms1888 KiB
2Wrong answer0/04ms2140 KiB
3Accepted4/43ms2340 KiB
4Wrong answer0/43ms2652 KiB
5Wrong answer0/43ms2964 KiB
6Wrong answer0/43ms3084 KiB
7Wrong answer0/43ms3076 KiB
8Partially correct2/43ms3272 KiB
9Wrong answer0/43ms3484 KiB
10Wrong answer0/43ms3480 KiB
11Wrong answer0/43ms3584 KiB
12Wrong answer0/43ms3652 KiB
13Wrong answer0/44ms3856 KiB
14Wrong answer0/44ms3948 KiB
15Accepted4/44ms4080 KiB
16Wrong answer0/44ms4080 KiB
17Wrong answer0/44ms4104 KiB
18Wrong answer0/44ms4344 KiB
19Wrong answer0/44ms4468 KiB
20Wrong answer0/44ms4596 KiB
21Wrong answer0/46ms4596 KiB
22Wrong answer0/44ms4804 KiB