69102023-12-19 16:51:19999Takaros Sorozat (80 pont)cpp17Wrong answer 42/807ms5808 KiB
// Source: https://usaco.guide/general/io

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

int main() {
	int n;cin>>n;
	string s; cin>>s;
	bool vane1=false,vane0=false;
	int cnt1=0,hely1=0;
	int cnt0=0,hely0=0;
	vector<int> v(n+1);
	for(int i = 0;i<n;i++){
		v[i+1]=s[i]-'0';
		if(v[i+1]==1&&!vane1){
			hely1=i+1;
			vane1=true;
		}
		if(v[i+1]==0)hely0=i+1;
	}
	for(int i = 1;i<=n;i++){
		if(i>hely1&&v[i]==0){
			cnt0++;
		}
	}
	for(int i = n;i>=1;i--){
		if(i<hely0&&v[i]==1){
			cnt1++;
		}
	}
	cout<<min(cnt1,cnt0)<<endl;
	cout<<min(cnt1,cnt0)<<endl;
}
SubtaskSumTestVerdictTimeMemory
base42/80
1Wrong answer0/03ms1936 KiB
2Wrong answer0/07ms3144 KiB
3Accepted4/43ms2472 KiB
4Accepted4/43ms2628 KiB
5Partially correct2/43ms2836 KiB
6Partially correct2/43ms2896 KiB
7Partially correct2/43ms3112 KiB
8Accepted4/43ms3316 KiB
9Partially correct2/43ms3532 KiB
10Partially correct2/43ms3772 KiB
11Partially correct2/43ms3876 KiB
12Partially correct2/43ms3956 KiB
13Accepted4/46ms5308 KiB
14Partially correct2/44ms5064 KiB
15Partially correct2/46ms5192 KiB
16Partially correct2/46ms5128 KiB
17Partially correct2/44ms5404 KiB
18Partially correct2/46ms5424 KiB
19Partially correct2/46ms5428 KiB
20Wrong answer0/46ms5620 KiB
21Wrong answer0/46ms5552 KiB
22Wrong answer0/47ms5808 KiB