71012023-12-30 12:38:13IgnácTakaros Sorozat (80 pont)cpp17Wrong answer 40/806ms3772 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 - 1;
}
SubtaskSumTestVerdictTimeMemory
base40/80
1Wrong answer0/03ms2092 KiB
2Wrong answer0/06ms2600 KiB
3Partially correct2/43ms2436 KiB
4Partially correct2/43ms2468 KiB
5Partially correct2/43ms2644 KiB
6Partially correct2/43ms2856 KiB
7Partially correct2/43ms3044 KiB
8Partially correct2/43ms3260 KiB
9Partially correct2/42ms3372 KiB
10Partially correct2/42ms3404 KiB
11Partially correct2/42ms3260 KiB
12Partially correct2/43ms3268 KiB
13Partially correct2/44ms3516 KiB
14Partially correct2/44ms3520 KiB
15Partially correct2/44ms3772 KiB
16Partially correct2/44ms3732 KiB
17Partially correct2/44ms3752 KiB
18Partially correct2/44ms3752 KiB
19Partially correct2/44ms3752 KiB
20Partially correct2/46ms3756 KiB
21Partially correct2/44ms3752 KiB
22Partially correct2/46ms3732 KiB