#include <bits/stdc++.h>
using namespace std;
const int Nmax = 1e6 + 5;
int a[Nmax], b[Nmax], a0[Nmax], b0[Nmax];
int i, n;
int main()
{
// freopen("input", "r", stdin);
cin.sync_with_stdio(false);
cin >> n;
string A, B;
cin >> A >> B;
for(i=1; i<=n; ++i)
a0[i] = A[i-1] - '0', b0[i] = B[i-1] - '0';
for(i=1; i<=n+1; ++i)
a[i] = a0[i-1] ^ a0[i], b[i] = b0[i-1] ^ b0[i];
int cnt = 0, j;
for(i=1; i<=n+1; ++i)
if(a[i] ^ b[i])
{
cnt ++;
for(j=i+1; j<=n+1; ++j)
if(a[j] == 0 && b[j] == 1) break;
i = j;
}
cout << cnt << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
356 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
356 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
22 ms |
18132 KB |
Output is correct |
8 |
Correct |
24 ms |
18132 KB |
Output is correct |
9 |
Correct |
24 ms |
18132 KB |
Output is correct |
10 |
Correct |
23 ms |
18124 KB |
Output is correct |
11 |
Correct |
24 ms |
18092 KB |
Output is correct |
12 |
Correct |
26 ms |
18260 KB |
Output is correct |
13 |
Correct |
24 ms |
18132 KB |
Output is correct |
14 |
Correct |
25 ms |
18132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
356 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |