71052023-12-30 12:41:06IgnácTakaros Sorozat (80 pont)cpp17Wrong answer 40/806ms4152 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 + 3;
}
SubtaskSumTestVerdictTimeMemory
base40/80
1Wrong answer0/03ms1812 KiB
2Wrong answer0/06ms2408 KiB
3Partially correct2/43ms2068 KiB
4Partially correct2/43ms2404 KiB
5Partially correct2/43ms2680 KiB
6Partially correct2/43ms2720 KiB
7Partially correct2/43ms2940 KiB
8Partially correct2/43ms3040 KiB
9Partially correct2/43ms3032 KiB
10Partially correct2/43ms3100 KiB
11Partially correct2/43ms3348 KiB
12Partially correct2/43ms3552 KiB
13Partially correct2/44ms3780 KiB
14Partially correct2/44ms4036 KiB
15Partially correct2/44ms4076 KiB
16Partially correct2/44ms3992 KiB
17Partially correct2/44ms3944 KiB
18Partially correct2/44ms3940 KiB
19Partially correct2/44ms3944 KiB
20Partially correct2/46ms4104 KiB
21Partially correct2/46ms4112 KiB
22Partially correct2/46ms4152 KiB