이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |