#include <iostream>
#include <string>
using namespace std;
int main()
{
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int N, Q; cin >> N >> Q;
long long v[2] = {};
string s[2];
for (int i = 0; i < 2; i++) {
cin >> s[i];
for (int j = 0; j < N; j++) {
if (j & 1) v[i] -= s[i][j] - 'a';
else v[i] += s[i][j] - 'a';
}
}
cout << ((v[0] - v[1]) % 26 ? "ne" : "da") << '\n';
while (Q--) {
int i; char p; cin >> i >> p; --i;
if (i & 1) v[0] += s[0][i] - 'a';
else v[0] -= s[0][i] - 'a';
s[0][i] = p;
if (i & 1) v[0] -= s[0][i] - 'a';
else v[0] += s[0][i] - 'a';
cout << ((v[0] - v[1]) % 26 ? "ne" : "da") << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
0 ms |
212 KB |
Output is correct |
29 |
Correct |
0 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
0 ms |
212 KB |
Output is correct |
29 |
Correct |
0 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
6 ms |
3048 KB |
Output is correct |
32 |
Correct |
7 ms |
2948 KB |
Output is correct |
33 |
Correct |
7 ms |
3076 KB |
Output is correct |
34 |
Correct |
7 ms |
2804 KB |
Output is correct |
35 |
Correct |
7 ms |
3036 KB |
Output is correct |
36 |
Correct |
7 ms |
2948 KB |
Output is correct |
37 |
Correct |
6 ms |
3052 KB |
Output is correct |
38 |
Correct |
5 ms |
2984 KB |
Output is correct |
39 |
Correct |
6 ms |
3040 KB |
Output is correct |
40 |
Correct |
6 ms |
3076 KB |
Output is correct |
41 |
Correct |
5 ms |
3056 KB |
Output is correct |
42 |
Correct |
5 ms |
3028 KB |
Output is correct |
43 |
Correct |
9 ms |
3016 KB |
Output is correct |
44 |
Correct |
6 ms |
3040 KB |
Output is correct |
45 |
Correct |
6 ms |
3012 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
11 ms |
880 KB |
Output is correct |
17 |
Correct |
11 ms |
824 KB |
Output is correct |
18 |
Correct |
11 ms |
852 KB |
Output is correct |
19 |
Correct |
11 ms |
872 KB |
Output is correct |
20 |
Correct |
11 ms |
876 KB |
Output is correct |
21 |
Correct |
11 ms |
872 KB |
Output is correct |
22 |
Correct |
11 ms |
868 KB |
Output is correct |
23 |
Correct |
11 ms |
884 KB |
Output is correct |
24 |
Correct |
11 ms |
872 KB |
Output is correct |
25 |
Correct |
11 ms |
852 KB |
Output is correct |
26 |
Correct |
11 ms |
808 KB |
Output is correct |
27 |
Correct |
14 ms |
848 KB |
Output is correct |
28 |
Correct |
11 ms |
916 KB |
Output is correct |
29 |
Correct |
11 ms |
852 KB |
Output is correct |
30 |
Correct |
11 ms |
852 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
0 ms |
212 KB |
Output is correct |
29 |
Correct |
0 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
11 ms |
880 KB |
Output is correct |
32 |
Correct |
11 ms |
824 KB |
Output is correct |
33 |
Correct |
11 ms |
852 KB |
Output is correct |
34 |
Correct |
11 ms |
872 KB |
Output is correct |
35 |
Correct |
11 ms |
876 KB |
Output is correct |
36 |
Correct |
11 ms |
872 KB |
Output is correct |
37 |
Correct |
11 ms |
868 KB |
Output is correct |
38 |
Correct |
11 ms |
884 KB |
Output is correct |
39 |
Correct |
11 ms |
872 KB |
Output is correct |
40 |
Correct |
11 ms |
852 KB |
Output is correct |
41 |
Correct |
11 ms |
808 KB |
Output is correct |
42 |
Correct |
14 ms |
848 KB |
Output is correct |
43 |
Correct |
11 ms |
916 KB |
Output is correct |
44 |
Correct |
11 ms |
852 KB |
Output is correct |
45 |
Correct |
11 ms |
852 KB |
Output is correct |
46 |
Correct |
12 ms |
752 KB |
Output is correct |
47 |
Correct |
12 ms |
816 KB |
Output is correct |
48 |
Correct |
12 ms |
844 KB |
Output is correct |
49 |
Correct |
13 ms |
852 KB |
Output is correct |
50 |
Correct |
12 ms |
772 KB |
Output is correct |
51 |
Correct |
12 ms |
828 KB |
Output is correct |
52 |
Correct |
16 ms |
904 KB |
Output is correct |
53 |
Correct |
12 ms |
812 KB |
Output is correct |
54 |
Correct |
12 ms |
852 KB |
Output is correct |
55 |
Correct |
12 ms |
844 KB |
Output is correct |
56 |
Correct |
14 ms |
768 KB |
Output is correct |
57 |
Correct |
12 ms |
808 KB |
Output is correct |
58 |
Correct |
12 ms |
848 KB |
Output is correct |
59 |
Correct |
12 ms |
820 KB |
Output is correct |
60 |
Correct |
12 ms |
844 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
0 ms |
212 KB |
Output is correct |
29 |
Correct |
0 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
6 ms |
3048 KB |
Output is correct |
32 |
Correct |
7 ms |
2948 KB |
Output is correct |
33 |
Correct |
7 ms |
3076 KB |
Output is correct |
34 |
Correct |
7 ms |
2804 KB |
Output is correct |
35 |
Correct |
7 ms |
3036 KB |
Output is correct |
36 |
Correct |
7 ms |
2948 KB |
Output is correct |
37 |
Correct |
6 ms |
3052 KB |
Output is correct |
38 |
Correct |
5 ms |
2984 KB |
Output is correct |
39 |
Correct |
6 ms |
3040 KB |
Output is correct |
40 |
Correct |
6 ms |
3076 KB |
Output is correct |
41 |
Correct |
5 ms |
3056 KB |
Output is correct |
42 |
Correct |
5 ms |
3028 KB |
Output is correct |
43 |
Correct |
9 ms |
3016 KB |
Output is correct |
44 |
Correct |
6 ms |
3040 KB |
Output is correct |
45 |
Correct |
6 ms |
3012 KB |
Output is correct |
46 |
Correct |
11 ms |
880 KB |
Output is correct |
47 |
Correct |
11 ms |
824 KB |
Output is correct |
48 |
Correct |
11 ms |
852 KB |
Output is correct |
49 |
Correct |
11 ms |
872 KB |
Output is correct |
50 |
Correct |
11 ms |
876 KB |
Output is correct |
51 |
Correct |
11 ms |
872 KB |
Output is correct |
52 |
Correct |
11 ms |
868 KB |
Output is correct |
53 |
Correct |
11 ms |
884 KB |
Output is correct |
54 |
Correct |
11 ms |
872 KB |
Output is correct |
55 |
Correct |
11 ms |
852 KB |
Output is correct |
56 |
Correct |
11 ms |
808 KB |
Output is correct |
57 |
Correct |
14 ms |
848 KB |
Output is correct |
58 |
Correct |
11 ms |
916 KB |
Output is correct |
59 |
Correct |
11 ms |
852 KB |
Output is correct |
60 |
Correct |
11 ms |
852 KB |
Output is correct |
61 |
Correct |
12 ms |
752 KB |
Output is correct |
62 |
Correct |
12 ms |
816 KB |
Output is correct |
63 |
Correct |
12 ms |
844 KB |
Output is correct |
64 |
Correct |
13 ms |
852 KB |
Output is correct |
65 |
Correct |
12 ms |
772 KB |
Output is correct |
66 |
Correct |
12 ms |
828 KB |
Output is correct |
67 |
Correct |
16 ms |
904 KB |
Output is correct |
68 |
Correct |
12 ms |
812 KB |
Output is correct |
69 |
Correct |
12 ms |
852 KB |
Output is correct |
70 |
Correct |
12 ms |
844 KB |
Output is correct |
71 |
Correct |
14 ms |
768 KB |
Output is correct |
72 |
Correct |
12 ms |
808 KB |
Output is correct |
73 |
Correct |
12 ms |
848 KB |
Output is correct |
74 |
Correct |
12 ms |
820 KB |
Output is correct |
75 |
Correct |
12 ms |
844 KB |
Output is correct |
76 |
Correct |
135 ms |
5800 KB |
Output is correct |
77 |
Correct |
128 ms |
6016 KB |
Output is correct |
78 |
Correct |
125 ms |
5596 KB |
Output is correct |
79 |
Correct |
137 ms |
5568 KB |
Output is correct |
80 |
Correct |
125 ms |
5596 KB |
Output is correct |
81 |
Correct |
127 ms |
5584 KB |
Output is correct |
82 |
Correct |
136 ms |
5628 KB |
Output is correct |
83 |
Correct |
128 ms |
5596 KB |
Output is correct |
84 |
Correct |
130 ms |
5632 KB |
Output is correct |
85 |
Correct |
125 ms |
5600 KB |
Output is correct |
86 |
Correct |
125 ms |
6004 KB |
Output is correct |
87 |
Correct |
125 ms |
5940 KB |
Output is correct |
88 |
Correct |
130 ms |
5968 KB |
Output is correct |
89 |
Correct |
125 ms |
5544 KB |
Output is correct |
90 |
Correct |
125 ms |
5936 KB |
Output is correct |