68992023-12-19 15:22:08999Takaros Sorozat (80 pont)cpp17Wrong answer 34/807ms5168 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;
	for(int i = 0; i<n; i++){
		if(v[i]=='1'){
			vane1=true;
		}
		if(vane1&&v[i]=='0'){
			cnt0++;
		}
	}
	for(int i = n-1;i>=0;i--){
		if(v[i]=='1'&&vane0){
			cnt1++;
		}
		if(v[i]=='0')vane0=true;
	}
	cout<<min(cnt1,cnt0)<<endl;
}
SubtaskSumTestVerdictTimeMemory
base34/80
1Wrong answer0/03ms1812 KiB
2Wrong answer0/07ms2520 KiB
3Partially correct2/43ms2320 KiB
4Partially correct2/43ms2404 KiB
5Partially correct2/43ms2540 KiB
6Partially correct2/43ms2660 KiB
7Partially correct2/43ms2860 KiB
8Partially correct2/43ms2948 KiB
9Partially correct2/43ms2956 KiB
10Partially correct2/43ms3116 KiB
11Partially correct2/43ms3120 KiB
12Partially correct2/43ms3220 KiB
13Partially correct2/44ms3504 KiB
14Partially correct2/44ms3612 KiB
15Partially correct2/44ms3976 KiB
16Partially correct2/44ms4300 KiB
17Partially correct2/44ms4584 KiB
18Partially correct2/44ms4548 KiB
19Partially correct2/44ms4836 KiB
20Wrong answer0/46ms4756 KiB
21Wrong answer0/46ms4872 KiB
22Wrong answer0/46ms5168 KiB