69082023-12-19 16:38:40999Takaros Sorozat (80 pont)cpp17Wrong answer 26/806ms4800 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;cin>>n;
	string v; cin>>v;
	bool vane1=false,vane0=false;
	int cnt1=0;
	int cnt0=0;
	v='2'+v+'2';
	int i = 1;
	while(i<=n){
		if(v[i]=='0'&&vane1){
			cnt0++;
			if(v[i+1]=='0'){
				i+=2;
				continue;
			}
		}
		if(v[i]=='1')vane1=true;
		i++;
	}
	i=n;
	while(i>0){
		if(v[i]=='1'&&vane0){
			cnt1++;
			if(v[i-1]=='1'){
				i-=2;
				continue;
			}
		}
		if(v[i]=='0')vane0=true;
		i--;
	}
	cout<<min(cnt1,cnt0)<<endl;
	cout<<min(cnt1,cnt0)<<endl;
}
SubtaskSumTestVerdictTimeMemory
base26/80
1Wrong answer0/03ms1816 KiB
2Wrong answer0/06ms2636 KiB
3Accepted4/43ms2264 KiB
4Accepted4/43ms2460 KiB
5Partially correct2/43ms2544 KiB
6Wrong answer0/43ms2788 KiB
7Wrong answer0/43ms2872 KiB
8Accepted4/43ms3116 KiB
9Wrong answer0/43ms3200 KiB
10Wrong answer0/43ms3324 KiB
11Wrong answer0/43ms3304 KiB
12Partially correct2/43ms3424 KiB
13Accepted4/44ms3956 KiB
14Partially correct2/44ms4064 KiB
15Partially correct2/44ms3816 KiB
16Wrong answer0/44ms4068 KiB
17Wrong answer0/44ms4104 KiB
18Wrong answer0/44ms4372 KiB
19Partially correct2/46ms4488 KiB
20Wrong answer0/46ms4688 KiB
21Wrong answer0/46ms4536 KiB
22Wrong answer0/46ms4800 KiB