#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define a2b(a, b) (a << b) // a*2^b
#define bit(a, b) ((a >> b) & 1) // bth bit from the right, starts at zero
#define n1p(x) (x%2==1?-1:1) // (-1)^x
using namespace std;
template<class T> using vec = vector<T>;
const int INFTY = (1LL << 63) - 1;
const int NNFTY = 1LL << 63;
int32_t main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n, q; cin >> n >> q;
string s1, s2; cin >> s1 >> s2;
int mod26 = 0;
for (int i = 0; i < n; i++) {
mod26 += n1p(i)*(s1[i] - s2[i]);
}
cout << "ne\n\0da\n" + 4*(mod26%26==0);
while (q--) {
int i; char c; cin >> i >> c; i--;
mod26 -= n1p(i)*(s1[i]-c);
s1[i] = c;
cout << "ne\n\0da\n" + 4*(mod26%26==0);
}
}
Compilation message
Main.cpp:10:31: warning: integer overflow in expression of type 'long long int' results in '9223372036854775807' [-Woverflow]
10 | const int INFTY = (1LL << 63) - 1;
| ~~~~~~~~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
516 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
504 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
516 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
504 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
1 ms |
336 KB |
Output is correct |
23 |
Correct |
1 ms |
504 KB |
Output is correct |
24 |
Correct |
1 ms |
336 KB |
Output is correct |
25 |
Correct |
1 ms |
336 KB |
Output is correct |
26 |
Correct |
1 ms |
336 KB |
Output is correct |
27 |
Correct |
1 ms |
504 KB |
Output is correct |
28 |
Correct |
1 ms |
336 KB |
Output is correct |
29 |
Correct |
1 ms |
336 KB |
Output is correct |
30 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
516 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
504 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
1 ms |
336 KB |
Output is correct |
23 |
Correct |
1 ms |
504 KB |
Output is correct |
24 |
Correct |
1 ms |
336 KB |
Output is correct |
25 |
Correct |
1 ms |
336 KB |
Output is correct |
26 |
Correct |
1 ms |
336 KB |
Output is correct |
27 |
Correct |
1 ms |
504 KB |
Output is correct |
28 |
Correct |
1 ms |
336 KB |
Output is correct |
29 |
Correct |
1 ms |
336 KB |
Output is correct |
30 |
Correct |
1 ms |
336 KB |
Output is correct |
31 |
Correct |
7 ms |
4588 KB |
Output is correct |
32 |
Correct |
7 ms |
4588 KB |
Output is correct |
33 |
Correct |
8 ms |
4500 KB |
Output is correct |
34 |
Correct |
7 ms |
4496 KB |
Output is correct |
35 |
Correct |
7 ms |
4588 KB |
Output is correct |
36 |
Correct |
10 ms |
3948 KB |
Output is correct |
37 |
Correct |
9 ms |
4212 KB |
Output is correct |
38 |
Correct |
8 ms |
4496 KB |
Output is correct |
39 |
Correct |
8 ms |
4844 KB |
Output is correct |
40 |
Correct |
8 ms |
4832 KB |
Output is correct |
41 |
Correct |
8 ms |
4604 KB |
Output is correct |
42 |
Correct |
8 ms |
4588 KB |
Output is correct |
43 |
Correct |
8 ms |
4848 KB |
Output is correct |
44 |
Correct |
9 ms |
4256 KB |
Output is correct |
45 |
Correct |
7 ms |
4588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
516 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
504 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
7 ms |
1104 KB |
Output is correct |
17 |
Correct |
6 ms |
592 KB |
Output is correct |
18 |
Correct |
7 ms |
1100 KB |
Output is correct |
19 |
Correct |
8 ms |
1104 KB |
Output is correct |
20 |
Correct |
7 ms |
592 KB |
Output is correct |
21 |
Correct |
8 ms |
1104 KB |
Output is correct |
22 |
Correct |
7 ms |
1104 KB |
Output is correct |
23 |
Correct |
9 ms |
1104 KB |
Output is correct |
24 |
Correct |
7 ms |
1104 KB |
Output is correct |
25 |
Correct |
7 ms |
1104 KB |
Output is correct |
26 |
Correct |
7 ms |
1104 KB |
Output is correct |
27 |
Correct |
8 ms |
1104 KB |
Output is correct |
28 |
Correct |
9 ms |
1104 KB |
Output is correct |
29 |
Correct |
7 ms |
1272 KB |
Output is correct |
30 |
Correct |
7 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
516 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
504 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
1 ms |
336 KB |
Output is correct |
23 |
Correct |
1 ms |
504 KB |
Output is correct |
24 |
Correct |
1 ms |
336 KB |
Output is correct |
25 |
Correct |
1 ms |
336 KB |
Output is correct |
26 |
Correct |
1 ms |
336 KB |
Output is correct |
27 |
Correct |
1 ms |
504 KB |
Output is correct |
28 |
Correct |
1 ms |
336 KB |
Output is correct |
29 |
Correct |
1 ms |
336 KB |
Output is correct |
30 |
Correct |
1 ms |
336 KB |
Output is correct |
31 |
Correct |
7 ms |
1104 KB |
Output is correct |
32 |
Correct |
6 ms |
592 KB |
Output is correct |
33 |
Correct |
7 ms |
1100 KB |
Output is correct |
34 |
Correct |
8 ms |
1104 KB |
Output is correct |
35 |
Correct |
7 ms |
592 KB |
Output is correct |
36 |
Correct |
8 ms |
1104 KB |
Output is correct |
37 |
Correct |
7 ms |
1104 KB |
Output is correct |
38 |
Correct |
9 ms |
1104 KB |
Output is correct |
39 |
Correct |
7 ms |
1104 KB |
Output is correct |
40 |
Correct |
7 ms |
1104 KB |
Output is correct |
41 |
Correct |
7 ms |
1104 KB |
Output is correct |
42 |
Correct |
8 ms |
1104 KB |
Output is correct |
43 |
Correct |
9 ms |
1104 KB |
Output is correct |
44 |
Correct |
7 ms |
1272 KB |
Output is correct |
45 |
Correct |
7 ms |
592 KB |
Output is correct |
46 |
Correct |
8 ms |
1236 KB |
Output is correct |
47 |
Correct |
8 ms |
1104 KB |
Output is correct |
48 |
Correct |
12 ms |
1104 KB |
Output is correct |
49 |
Correct |
8 ms |
1104 KB |
Output is correct |
50 |
Correct |
8 ms |
1336 KB |
Output is correct |
51 |
Correct |
8 ms |
1104 KB |
Output is correct |
52 |
Correct |
8 ms |
1104 KB |
Output is correct |
53 |
Correct |
8 ms |
1104 KB |
Output is correct |
54 |
Correct |
8 ms |
1104 KB |
Output is correct |
55 |
Correct |
7 ms |
1104 KB |
Output is correct |
56 |
Correct |
8 ms |
1276 KB |
Output is correct |
57 |
Correct |
8 ms |
1104 KB |
Output is correct |
58 |
Correct |
8 ms |
1104 KB |
Output is correct |
59 |
Correct |
8 ms |
1104 KB |
Output is correct |
60 |
Correct |
7 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
516 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
504 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
1 ms |
336 KB |
Output is correct |
23 |
Correct |
1 ms |
504 KB |
Output is correct |
24 |
Correct |
1 ms |
336 KB |
Output is correct |
25 |
Correct |
1 ms |
336 KB |
Output is correct |
26 |
Correct |
1 ms |
336 KB |
Output is correct |
27 |
Correct |
1 ms |
504 KB |
Output is correct |
28 |
Correct |
1 ms |
336 KB |
Output is correct |
29 |
Correct |
1 ms |
336 KB |
Output is correct |
30 |
Correct |
1 ms |
336 KB |
Output is correct |
31 |
Correct |
7 ms |
4588 KB |
Output is correct |
32 |
Correct |
7 ms |
4588 KB |
Output is correct |
33 |
Correct |
8 ms |
4500 KB |
Output is correct |
34 |
Correct |
7 ms |
4496 KB |
Output is correct |
35 |
Correct |
7 ms |
4588 KB |
Output is correct |
36 |
Correct |
10 ms |
3948 KB |
Output is correct |
37 |
Correct |
9 ms |
4212 KB |
Output is correct |
38 |
Correct |
8 ms |
4496 KB |
Output is correct |
39 |
Correct |
8 ms |
4844 KB |
Output is correct |
40 |
Correct |
8 ms |
4832 KB |
Output is correct |
41 |
Correct |
8 ms |
4604 KB |
Output is correct |
42 |
Correct |
8 ms |
4588 KB |
Output is correct |
43 |
Correct |
8 ms |
4848 KB |
Output is correct |
44 |
Correct |
9 ms |
4256 KB |
Output is correct |
45 |
Correct |
7 ms |
4588 KB |
Output is correct |
46 |
Correct |
7 ms |
1104 KB |
Output is correct |
47 |
Correct |
6 ms |
592 KB |
Output is correct |
48 |
Correct |
7 ms |
1100 KB |
Output is correct |
49 |
Correct |
8 ms |
1104 KB |
Output is correct |
50 |
Correct |
7 ms |
592 KB |
Output is correct |
51 |
Correct |
8 ms |
1104 KB |
Output is correct |
52 |
Correct |
7 ms |
1104 KB |
Output is correct |
53 |
Correct |
9 ms |
1104 KB |
Output is correct |
54 |
Correct |
7 ms |
1104 KB |
Output is correct |
55 |
Correct |
7 ms |
1104 KB |
Output is correct |
56 |
Correct |
7 ms |
1104 KB |
Output is correct |
57 |
Correct |
8 ms |
1104 KB |
Output is correct |
58 |
Correct |
9 ms |
1104 KB |
Output is correct |
59 |
Correct |
7 ms |
1272 KB |
Output is correct |
60 |
Correct |
7 ms |
592 KB |
Output is correct |
61 |
Correct |
8 ms |
1236 KB |
Output is correct |
62 |
Correct |
8 ms |
1104 KB |
Output is correct |
63 |
Correct |
12 ms |
1104 KB |
Output is correct |
64 |
Correct |
8 ms |
1104 KB |
Output is correct |
65 |
Correct |
8 ms |
1336 KB |
Output is correct |
66 |
Correct |
8 ms |
1104 KB |
Output is correct |
67 |
Correct |
8 ms |
1104 KB |
Output is correct |
68 |
Correct |
8 ms |
1104 KB |
Output is correct |
69 |
Correct |
8 ms |
1104 KB |
Output is correct |
70 |
Correct |
7 ms |
1104 KB |
Output is correct |
71 |
Correct |
8 ms |
1276 KB |
Output is correct |
72 |
Correct |
8 ms |
1104 KB |
Output is correct |
73 |
Correct |
8 ms |
1104 KB |
Output is correct |
74 |
Correct |
8 ms |
1104 KB |
Output is correct |
75 |
Correct |
7 ms |
592 KB |
Output is correct |
76 |
Correct |
99 ms |
15992 KB |
Output is correct |
77 |
Correct |
101 ms |
16424 KB |
Output is correct |
78 |
Correct |
111 ms |
16200 KB |
Output is correct |
79 |
Correct |
101 ms |
15992 KB |
Output is correct |
80 |
Correct |
102 ms |
15996 KB |
Output is correct |
81 |
Correct |
109 ms |
15984 KB |
Output is correct |
82 |
Correct |
98 ms |
16000 KB |
Output is correct |
83 |
Correct |
109 ms |
16152 KB |
Output is correct |
84 |
Correct |
104 ms |
16244 KB |
Output is correct |
85 |
Correct |
98 ms |
15996 KB |
Output is correct |
86 |
Correct |
106 ms |
16464 KB |
Output is correct |
87 |
Correct |
115 ms |
16460 KB |
Output is correct |
88 |
Correct |
104 ms |
16356 KB |
Output is correct |
89 |
Correct |
105 ms |
15968 KB |
Output is correct |
90 |
Correct |
111 ms |
16344 KB |
Output is correct |