#include <bits/stdc++.h>
namespace MX {
constexpr int A = 26;
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int N, Q;
std::cin >> N >> Q;
std::string A;
std::cin >> A;
std::string B;
std::cin >> B;
int odd = 0, eve = 0;
auto clean = [&]() {
odd += MX::A;
odd %= MX::A;
eve += MX::A;
eve %= MX::A;
};
for (int i = 0; i < N; i++) {
(i % 2 ? odd : eve) += (B[i] - A[i] + MX::A) % MX::A;
clean();
}
std::cout << (odd == eve ? "da" : "ne") << "\n";
for (int q = 0; q < Q; q++) {
int p;
char c;
std::cin >> p >> c;
p--;
(p % 2 ? odd : eve) -= (B[p] - A[p]);
A[p] = c;
(p % 2 ? odd : eve) += (B[p] - A[p]);
clean();
std::cout << (odd == eve ? "da" : "ne") << "\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
6 ms |
2808 KB |
Output is correct |
32 |
Correct |
6 ms |
2808 KB |
Output is correct |
33 |
Correct |
6 ms |
2808 KB |
Output is correct |
34 |
Correct |
6 ms |
2808 KB |
Output is correct |
35 |
Correct |
6 ms |
2808 KB |
Output is correct |
36 |
Correct |
6 ms |
2804 KB |
Output is correct |
37 |
Correct |
6 ms |
2812 KB |
Output is correct |
38 |
Correct |
6 ms |
2804 KB |
Output is correct |
39 |
Correct |
6 ms |
2808 KB |
Output is correct |
40 |
Correct |
6 ms |
2808 KB |
Output is correct |
41 |
Correct |
6 ms |
2808 KB |
Output is correct |
42 |
Correct |
6 ms |
2808 KB |
Output is correct |
43 |
Correct |
6 ms |
2808 KB |
Output is correct |
44 |
Correct |
6 ms |
2696 KB |
Output is correct |
45 |
Correct |
6 ms |
3260 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
10 ms |
604 KB |
Output is correct |
17 |
Correct |
10 ms |
604 KB |
Output is correct |
18 |
Correct |
10 ms |
604 KB |
Output is correct |
19 |
Correct |
10 ms |
604 KB |
Output is correct |
20 |
Correct |
10 ms |
604 KB |
Output is correct |
21 |
Correct |
10 ms |
600 KB |
Output is correct |
22 |
Correct |
10 ms |
604 KB |
Output is correct |
23 |
Correct |
10 ms |
548 KB |
Output is correct |
24 |
Correct |
10 ms |
604 KB |
Output is correct |
25 |
Correct |
10 ms |
576 KB |
Output is correct |
26 |
Correct |
10 ms |
604 KB |
Output is correct |
27 |
Correct |
10 ms |
604 KB |
Output is correct |
28 |
Correct |
10 ms |
604 KB |
Output is correct |
29 |
Correct |
11 ms |
732 KB |
Output is correct |
30 |
Correct |
10 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
10 ms |
604 KB |
Output is correct |
32 |
Correct |
10 ms |
604 KB |
Output is correct |
33 |
Correct |
10 ms |
604 KB |
Output is correct |
34 |
Correct |
10 ms |
604 KB |
Output is correct |
35 |
Correct |
10 ms |
604 KB |
Output is correct |
36 |
Correct |
10 ms |
600 KB |
Output is correct |
37 |
Correct |
10 ms |
604 KB |
Output is correct |
38 |
Correct |
10 ms |
548 KB |
Output is correct |
39 |
Correct |
10 ms |
604 KB |
Output is correct |
40 |
Correct |
10 ms |
576 KB |
Output is correct |
41 |
Correct |
10 ms |
604 KB |
Output is correct |
42 |
Correct |
10 ms |
604 KB |
Output is correct |
43 |
Correct |
10 ms |
604 KB |
Output is correct |
44 |
Correct |
11 ms |
732 KB |
Output is correct |
45 |
Correct |
10 ms |
600 KB |
Output is correct |
46 |
Correct |
14 ms |
604 KB |
Output is correct |
47 |
Correct |
11 ms |
604 KB |
Output is correct |
48 |
Correct |
11 ms |
564 KB |
Output is correct |
49 |
Correct |
15 ms |
600 KB |
Output is correct |
50 |
Correct |
11 ms |
612 KB |
Output is correct |
51 |
Correct |
11 ms |
604 KB |
Output is correct |
52 |
Correct |
11 ms |
604 KB |
Output is correct |
53 |
Correct |
11 ms |
604 KB |
Output is correct |
54 |
Correct |
11 ms |
604 KB |
Output is correct |
55 |
Correct |
11 ms |
604 KB |
Output is correct |
56 |
Correct |
11 ms |
600 KB |
Output is correct |
57 |
Correct |
11 ms |
604 KB |
Output is correct |
58 |
Correct |
14 ms |
860 KB |
Output is correct |
59 |
Correct |
11 ms |
604 KB |
Output is correct |
60 |
Correct |
11 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
6 ms |
2808 KB |
Output is correct |
32 |
Correct |
6 ms |
2808 KB |
Output is correct |
33 |
Correct |
6 ms |
2808 KB |
Output is correct |
34 |
Correct |
6 ms |
2808 KB |
Output is correct |
35 |
Correct |
6 ms |
2808 KB |
Output is correct |
36 |
Correct |
6 ms |
2804 KB |
Output is correct |
37 |
Correct |
6 ms |
2812 KB |
Output is correct |
38 |
Correct |
6 ms |
2804 KB |
Output is correct |
39 |
Correct |
6 ms |
2808 KB |
Output is correct |
40 |
Correct |
6 ms |
2808 KB |
Output is correct |
41 |
Correct |
6 ms |
2808 KB |
Output is correct |
42 |
Correct |
6 ms |
2808 KB |
Output is correct |
43 |
Correct |
6 ms |
2808 KB |
Output is correct |
44 |
Correct |
6 ms |
2696 KB |
Output is correct |
45 |
Correct |
6 ms |
3260 KB |
Output is correct |
46 |
Correct |
10 ms |
604 KB |
Output is correct |
47 |
Correct |
10 ms |
604 KB |
Output is correct |
48 |
Correct |
10 ms |
604 KB |
Output is correct |
49 |
Correct |
10 ms |
604 KB |
Output is correct |
50 |
Correct |
10 ms |
604 KB |
Output is correct |
51 |
Correct |
10 ms |
600 KB |
Output is correct |
52 |
Correct |
10 ms |
604 KB |
Output is correct |
53 |
Correct |
10 ms |
548 KB |
Output is correct |
54 |
Correct |
10 ms |
604 KB |
Output is correct |
55 |
Correct |
10 ms |
576 KB |
Output is correct |
56 |
Correct |
10 ms |
604 KB |
Output is correct |
57 |
Correct |
10 ms |
604 KB |
Output is correct |
58 |
Correct |
10 ms |
604 KB |
Output is correct |
59 |
Correct |
11 ms |
732 KB |
Output is correct |
60 |
Correct |
10 ms |
600 KB |
Output is correct |
61 |
Correct |
14 ms |
604 KB |
Output is correct |
62 |
Correct |
11 ms |
604 KB |
Output is correct |
63 |
Correct |
11 ms |
564 KB |
Output is correct |
64 |
Correct |
15 ms |
600 KB |
Output is correct |
65 |
Correct |
11 ms |
612 KB |
Output is correct |
66 |
Correct |
11 ms |
604 KB |
Output is correct |
67 |
Correct |
11 ms |
604 KB |
Output is correct |
68 |
Correct |
11 ms |
604 KB |
Output is correct |
69 |
Correct |
11 ms |
604 KB |
Output is correct |
70 |
Correct |
11 ms |
604 KB |
Output is correct |
71 |
Correct |
11 ms |
600 KB |
Output is correct |
72 |
Correct |
11 ms |
604 KB |
Output is correct |
73 |
Correct |
14 ms |
860 KB |
Output is correct |
74 |
Correct |
11 ms |
604 KB |
Output is correct |
75 |
Correct |
11 ms |
604 KB |
Output is correct |
76 |
Correct |
131 ms |
5400 KB |
Output is correct |
77 |
Correct |
131 ms |
5884 KB |
Output is correct |
78 |
Correct |
137 ms |
5552 KB |
Output is correct |
79 |
Correct |
151 ms |
5476 KB |
Output is correct |
80 |
Correct |
134 ms |
5636 KB |
Output is correct |
81 |
Correct |
137 ms |
5500 KB |
Output is correct |
82 |
Correct |
130 ms |
5388 KB |
Output is correct |
83 |
Correct |
131 ms |
5544 KB |
Output is correct |
84 |
Correct |
142 ms |
5504 KB |
Output is correct |
85 |
Correct |
140 ms |
5512 KB |
Output is correct |
86 |
Correct |
150 ms |
5684 KB |
Output is correct |
87 |
Correct |
136 ms |
5864 KB |
Output is correct |
88 |
Correct |
134 ms |
5724 KB |
Output is correct |
89 |
Correct |
150 ms |
5392 KB |
Output is correct |
90 |
Correct |
133 ms |
5712 KB |
Output is correct |