43162023-03-24 00:46:40tomi7Takaros Sorozat (80 pont)cpp11Wrong answer 42/806ms4088 KiB
// Source: https://usaco.guide/general/io

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

long long lko(unsigned long long n, unsigned long long m){
	if(n%m==0 || m%n==0){
		return min(n, m);
	}
	if(n>m){
		return lko(n%m, m);
	}else{
		return lko(m%n, n);
	}
}

int main() {
	int n;
	cin>>n;
	string a;
	cin>>a;
	bool b=true;
	int c1=0, c0=0;
	for(int i=0;i<n;i++){
		if(a[i]=='0' && !b){
			c0++;
//			cout<<"123"<<'\n';
		}else if(a[i]=='1'){
			c1++;
//			cout<<"abc"<<'\n';
			b=false;
		}
	}
	for(int i=n-1;i>=0;i--){
		if(a[i]=='0'){
			break;
		}else{
			c1--;
		}
	}
	cout<<min(c1, c0)<<'\n';
	cout<<min(c1, c0)<<'\n';
//	cout<<c1<<' '<<c0<<'\n';
}
SubtaskSumTestVerdictTimeMemory
base42/80
1Wrong answer0/03ms1808 KiB
2Wrong answer0/06ms2444 KiB
3Accepted4/43ms2220 KiB
4Accepted4/43ms2428 KiB
5Partially correct2/43ms2640 KiB
6Partially correct2/43ms2856 KiB
7Partially correct2/42ms2796 KiB
8Accepted4/43ms2924 KiB
9Partially correct2/43ms3008 KiB
10Partially correct2/42ms3164 KiB
11Partially correct2/42ms3136 KiB
12Partially correct2/43ms3136 KiB
13Accepted4/44ms3536 KiB
14Partially correct2/44ms3472 KiB
15Partially correct2/44ms3480 KiB
16Partially correct2/44ms3476 KiB
17Partially correct2/44ms3600 KiB
18Partially correct2/44ms3616 KiB
19Partially correct2/44ms3872 KiB
20Wrong answer0/44ms4088 KiB
21Wrong answer0/44ms4036 KiB
22Wrong answer0/44ms4036 KiB