71042023-12-30 12:40:18IgnácTakaros Sorozat (80 pont)cpp17Wrong answer 44/806ms4628 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
base44/80
1Wrong answer0/03ms1816 KiB
2Wrong answer0/06ms2384 KiB
3Partially correct2/43ms2216 KiB
4Partially correct2/43ms2432 KiB
5Partially correct2/42ms2508 KiB
6Partially correct2/43ms2656 KiB
7Partially correct2/43ms2744 KiB
8Partially correct2/43ms2824 KiB
9Partially correct2/43ms2948 KiB
10Accepted4/43ms3036 KiB
11Partially correct2/43ms3040 KiB
12Partially correct2/43ms3164 KiB
13Partially correct2/44ms3760 KiB
14Partially correct2/44ms4052 KiB
15Partially correct2/44ms4344 KiB
16Partially correct2/44ms4552 KiB
17Accepted4/44ms4576 KiB
18Partially correct2/44ms4356 KiB
19Partially correct2/44ms4376 KiB
20Partially correct2/46ms4376 KiB
21Partially correct2/44ms4376 KiB
22Partially correct2/46ms4628 KiB