71002023-12-30 12:28:56IgnácTakaros Sorozat (80 pont)cpp17Wrong answer 64/806ms4124 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	string s;
	cin >> n >> s;
	int kezd1 = 0 , veg0 = count(s.begin(), s.end(), '0'), mini = veg0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '1') kezd1++;
		else veg0--;
		if (kezd1 + veg0 < mini) mini = kezd1 + veg0;
	}

	cout << mini << '\n' << mini - mini / 2;
}
SubtaskSumTestVerdictTimeMemory
base64/80
1Accepted0/03ms1812 KiB
2Wrong answer0/06ms2440 KiB
3Accepted4/43ms2284 KiB
4Accepted4/43ms2628 KiB
5Accepted4/43ms2612 KiB
6Accepted4/43ms2724 KiB
7Accepted4/43ms2804 KiB
8Partially correct2/43ms2892 KiB
9Accepted4/43ms2972 KiB
10Partially correct2/43ms3248 KiB
11Accepted4/43ms3188 KiB
12Accepted4/43ms3192 KiB
13Accepted4/44ms3572 KiB
14Accepted4/44ms3616 KiB
15Accepted4/44ms3592 KiB
16Accepted4/44ms3584 KiB
17Partially correct2/44ms3716 KiB
18Partially correct2/44ms3904 KiB
19Partially correct2/44ms3864 KiB
20Partially correct2/46ms3864 KiB
21Partially correct2/44ms3868 KiB
22Partially correct2/46ms4124 KiB