This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std ;
const int N = 1e6 ;
int n ;
bool flag ;
char a[N + 1], b[N + 2] ;
signed main()
{
ios_base::sync_with_stdio( 0 ) ;
cin.tie( 0 ) ;
cout.tie( 0 ) ;
cin >> n ;
for(int i = 1 ; i <= n ; i++)
{
cin >> a[i] ;
if(a[i] == '1')
flag = 1 ;
}
for(int i = 1 ; i <= n ; i++)
cin >> b[i] ;
if(!flag)
{
int ans = 0 ;
b[n + 1] = '0' ;
for(int i = 1 ; i <= n ; i++)
if(b[i] == '1' && b[i + 1] == '0')
ans++ ;
cout << ans ;
return 0 ;
}
return 0 ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |