71022023-12-30 12:38:56IgnácTakaros Sorozat (80 pont)cpp17Wrong answer 40/806ms5128 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 - 2;
}
SubtaskSumTestVerdictTimeMemory
base40/80
1Wrong answer0/03ms1812 KiB
2Wrong answer0/06ms2388 KiB
3Partially correct2/43ms2280 KiB
4Partially correct2/43ms2332 KiB
5Partially correct2/43ms2328 KiB
6Partially correct2/43ms2528 KiB
7Partially correct2/43ms2736 KiB
8Partially correct2/43ms2952 KiB
9Partially correct2/43ms3160 KiB
10Partially correct2/43ms3376 KiB
11Partially correct2/43ms3460 KiB
12Partially correct2/43ms3700 KiB
13Partially correct2/44ms4176 KiB
14Partially correct2/44ms4128 KiB
15Partially correct2/44ms4428 KiB
16Partially correct2/44ms4344 KiB
17Partially correct2/44ms4344 KiB
18Partially correct2/44ms4596 KiB
19Partially correct2/44ms4884 KiB
20Partially correct2/46ms5108 KiB
21Partially correct2/44ms5044 KiB
22Partially correct2/46ms5128 KiB