#include "bits/stdc++.h"
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define debug(...)
#endif
void move(char& c, int ops) {
while (ops > 0) {
c = (c == 'z' ? 'a' : c + 1);
ops--;
}
}
void check(string s, string t) {
int n = (int) s.size();
for (int i = 0; i < n - 1; ++i) {
int diff = t[i] - s[i];
if (diff < 0) {
diff += 26;
}
if (diff > 0) {
move(s[i], diff);
move(s[i + 1], diff);
}
}
cout << (s[n - 1] == t[n - 1] ? "da" : "ne") << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
string s, t;
cin >> s >> t;
check(s, t);
while (q--) {
int p;
char c;
cin >> p >> c;
s[p - 1] = c;
check(s, t);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 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 |
0 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 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 |
0 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 |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
376 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
464 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
356 KB |
Output is correct |
28 |
Correct |
0 ms |
356 KB |
Output is correct |
29 |
Correct |
0 ms |
356 KB |
Output is correct |
30 |
Correct |
0 ms |
356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 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 |
0 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 |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
376 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
464 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
356 KB |
Output is correct |
28 |
Correct |
0 ms |
356 KB |
Output is correct |
29 |
Correct |
0 ms |
356 KB |
Output is correct |
30 |
Correct |
0 ms |
356 KB |
Output is correct |
31 |
Correct |
38 ms |
6444 KB |
Output is correct |
32 |
Correct |
38 ms |
6284 KB |
Output is correct |
33 |
Correct |
37 ms |
6304 KB |
Output is correct |
34 |
Correct |
38 ms |
6300 KB |
Output is correct |
35 |
Correct |
46 ms |
6284 KB |
Output is correct |
36 |
Correct |
37 ms |
6644 KB |
Output is correct |
37 |
Correct |
37 ms |
6644 KB |
Output is correct |
38 |
Correct |
37 ms |
6300 KB |
Output is correct |
39 |
Correct |
37 ms |
6708 KB |
Output is correct |
40 |
Correct |
37 ms |
6636 KB |
Output is correct |
41 |
Correct |
37 ms |
6296 KB |
Output is correct |
42 |
Correct |
37 ms |
6284 KB |
Output is correct |
43 |
Correct |
37 ms |
6820 KB |
Output is correct |
44 |
Correct |
37 ms |
6316 KB |
Output is correct |
45 |
Correct |
37 ms |
6296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 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 |
0 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 |
22 ms |
1040 KB |
Output is correct |
17 |
Correct |
22 ms |
1028 KB |
Output is correct |
18 |
Correct |
22 ms |
1096 KB |
Output is correct |
19 |
Correct |
22 ms |
1108 KB |
Output is correct |
20 |
Correct |
22 ms |
1116 KB |
Output is correct |
21 |
Correct |
22 ms |
956 KB |
Output is correct |
22 |
Correct |
22 ms |
1076 KB |
Output is correct |
23 |
Correct |
22 ms |
1116 KB |
Output is correct |
24 |
Correct |
22 ms |
1108 KB |
Output is correct |
25 |
Correct |
22 ms |
1360 KB |
Output is correct |
26 |
Correct |
22 ms |
1112 KB |
Output is correct |
27 |
Correct |
22 ms |
1116 KB |
Output is correct |
28 |
Correct |
22 ms |
1104 KB |
Output is correct |
29 |
Correct |
22 ms |
1116 KB |
Output is correct |
30 |
Correct |
22 ms |
1116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 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 |
0 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 |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
376 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
464 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
356 KB |
Output is correct |
28 |
Correct |
0 ms |
356 KB |
Output is correct |
29 |
Correct |
0 ms |
356 KB |
Output is correct |
30 |
Correct |
0 ms |
356 KB |
Output is correct |
31 |
Correct |
22 ms |
1040 KB |
Output is correct |
32 |
Correct |
22 ms |
1028 KB |
Output is correct |
33 |
Correct |
22 ms |
1096 KB |
Output is correct |
34 |
Correct |
22 ms |
1108 KB |
Output is correct |
35 |
Correct |
22 ms |
1116 KB |
Output is correct |
36 |
Correct |
22 ms |
956 KB |
Output is correct |
37 |
Correct |
22 ms |
1076 KB |
Output is correct |
38 |
Correct |
22 ms |
1116 KB |
Output is correct |
39 |
Correct |
22 ms |
1108 KB |
Output is correct |
40 |
Correct |
22 ms |
1360 KB |
Output is correct |
41 |
Correct |
22 ms |
1112 KB |
Output is correct |
42 |
Correct |
22 ms |
1116 KB |
Output is correct |
43 |
Correct |
22 ms |
1104 KB |
Output is correct |
44 |
Correct |
22 ms |
1116 KB |
Output is correct |
45 |
Correct |
22 ms |
1116 KB |
Output is correct |
46 |
Execution timed out |
1033 ms |
744 KB |
Time limit exceeded |
47 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 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 |
0 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 |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
376 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
464 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
356 KB |
Output is correct |
28 |
Correct |
0 ms |
356 KB |
Output is correct |
29 |
Correct |
0 ms |
356 KB |
Output is correct |
30 |
Correct |
0 ms |
356 KB |
Output is correct |
31 |
Correct |
38 ms |
6444 KB |
Output is correct |
32 |
Correct |
38 ms |
6284 KB |
Output is correct |
33 |
Correct |
37 ms |
6304 KB |
Output is correct |
34 |
Correct |
38 ms |
6300 KB |
Output is correct |
35 |
Correct |
46 ms |
6284 KB |
Output is correct |
36 |
Correct |
37 ms |
6644 KB |
Output is correct |
37 |
Correct |
37 ms |
6644 KB |
Output is correct |
38 |
Correct |
37 ms |
6300 KB |
Output is correct |
39 |
Correct |
37 ms |
6708 KB |
Output is correct |
40 |
Correct |
37 ms |
6636 KB |
Output is correct |
41 |
Correct |
37 ms |
6296 KB |
Output is correct |
42 |
Correct |
37 ms |
6284 KB |
Output is correct |
43 |
Correct |
37 ms |
6820 KB |
Output is correct |
44 |
Correct |
37 ms |
6316 KB |
Output is correct |
45 |
Correct |
37 ms |
6296 KB |
Output is correct |
46 |
Correct |
22 ms |
1040 KB |
Output is correct |
47 |
Correct |
22 ms |
1028 KB |
Output is correct |
48 |
Correct |
22 ms |
1096 KB |
Output is correct |
49 |
Correct |
22 ms |
1108 KB |
Output is correct |
50 |
Correct |
22 ms |
1116 KB |
Output is correct |
51 |
Correct |
22 ms |
956 KB |
Output is correct |
52 |
Correct |
22 ms |
1076 KB |
Output is correct |
53 |
Correct |
22 ms |
1116 KB |
Output is correct |
54 |
Correct |
22 ms |
1108 KB |
Output is correct |
55 |
Correct |
22 ms |
1360 KB |
Output is correct |
56 |
Correct |
22 ms |
1112 KB |
Output is correct |
57 |
Correct |
22 ms |
1116 KB |
Output is correct |
58 |
Correct |
22 ms |
1104 KB |
Output is correct |
59 |
Correct |
22 ms |
1116 KB |
Output is correct |
60 |
Correct |
22 ms |
1116 KB |
Output is correct |
61 |
Execution timed out |
1033 ms |
744 KB |
Time limit exceeded |
62 |
Halted |
0 ms |
0 KB |
- |