#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 |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 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 |
224 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
50 ms |
4148 KB |
Output is correct |
8 |
Correct |
52 ms |
4056 KB |
Output is correct |
9 |
Correct |
51 ms |
4056 KB |
Output is correct |
10 |
Correct |
61 ms |
4152 KB |
Output is correct |
11 |
Correct |
51 ms |
4152 KB |
Output is correct |
12 |
Correct |
55 ms |
4144 KB |
Output is correct |
13 |
Correct |
49 ms |
4104 KB |
Output is correct |
14 |
Correct |
61 ms |
4076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |