#include <bits/stdc++.h>
using namespace std;
signed main() {
int n;
cin >> n;
string a, b;
cin >> a >> b;
a = ' ' + a;
b = ' ' + b;
int ans = 0;
for (int i = 1; i <= n; i++) {
if (b[i] == '1') {
int r = i;
while (r <= n && b[r] == '1') {
r++;
}r--;
ans++;
i = r;
}
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
60 ms |
4024 KB |
Output is correct |
8 |
Correct |
50 ms |
4032 KB |
Output is correct |
9 |
Correct |
52 ms |
4084 KB |
Output is correct |
10 |
Correct |
50 ms |
4044 KB |
Output is correct |
11 |
Correct |
51 ms |
4112 KB |
Output is correct |
12 |
Correct |
53 ms |
4072 KB |
Output is correct |
13 |
Correct |
69 ms |
4152 KB |
Output is correct |
14 |
Correct |
52 ms |
4036 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |