71032023-12-30 12:39:51IgnácTakaros Sorozat (80 pont)cpp17Wrong answer 42/806ms4636 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
base42/80
1Wrong answer0/03ms1952 KiB
2Wrong answer0/06ms2496 KiB
3Partially correct2/43ms2324 KiB
4Partially correct2/43ms2456 KiB
5Partially correct2/43ms2572 KiB
6Partially correct2/43ms2776 KiB
7Partially correct2/43ms2860 KiB
8Accepted4/43ms2996 KiB
9Partially correct2/43ms3208 KiB
10Partially correct2/42ms3288 KiB
11Partially correct2/43ms3552 KiB
12Partially correct2/43ms3656 KiB
13Partially correct2/44ms4144 KiB
14Partially correct2/44ms4320 KiB
15Partially correct2/44ms4196 KiB
16Partially correct2/44ms4464 KiB
17Partially correct2/44ms4396 KiB
18Partially correct2/44ms4516 KiB
19Partially correct2/44ms4336 KiB
20Partially correct2/46ms4372 KiB
21Partially correct2/46ms4636 KiB
22Partially correct2/46ms4548 KiB