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>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
#define pb push_back
#define F first
#define S second
//#define mp make_pair
#define all(x) x.begin(),x.end()
#define file freopen("txt.in", "r", stdin);freopen("txt.out", "w", stdout);
#define kill(x) {cout << x << '\n'; return 0;}
//#define int ll
#pragma GCC optimize("Ofast,unroll-loops")
const int N = 300 * 1000 + 10, LG = 24, MOD = 1e9+7, P = 701;
const ll inf = 1e12;
int n;
string s, t;
signed main(){
//file;
ios::sync_with_stdio(0);cin.tie(0);
cin >> n >> s >> t;
int cnt0 = 0;
for(int i = 0; i < n; ++i) {
cnt0 += (s[i] == '0');
}
if(cnt0 == n) {
t = t+'0';
int ans = 0;
for(int i = 1; i <= n; ++i) {
if(t[i-1] == '1' && t[i] == '1') continue;
if(t[i-1] == '1') ++ans;
}
cout << ans << '\n';
}
}
# | 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... |