// Author : FatihCihan
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
void solve(){
int n,q;
cin >> n >> q;
string s1 , s2;
cin >> s1 >> s2;
int arr[n] , sum[2] = {0,0};
for(int i = 0;i<n;i++){
arr[i] = s2[i] - s1[i];
if(arr[i] < 0)arr[i] += 26;
if(i < (n-1))sum[i & 1] += arr[i];
}
auto get = [&]{
int value = ((sum[n&1] - sum[(n&1)^1]) % 26 + 26) % 26;
if(value == arr[n-1])return "da";
else return "ne";
};
cout << get() << endl;
while(q--){
int pos;
char ch;
cin >> pos >> ch;
pos--;
if(pos < (n-1))sum[pos&1] -= arr[pos];
s1[pos] = ch;
arr[pos] = s2[pos] - s1[pos];
if(arr[pos] < 0)arr[pos] += 26;
if(pos < (n-1))sum[pos&1] += arr[pos];
cout << get() << '\n';
}
}
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int testcase = 1;//cin >> testcase;
while(testcase--)solve();
cerr << 1000.0 * clock() / CLOCKS_PER_SEC << " ms" << endl;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
504 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
508 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 |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 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 |
504 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
504 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
508 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 |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 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 |
504 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 |
508 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 |
336 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 |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
504 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
508 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 |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 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 |
504 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 |
508 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 |
336 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 |
504 KB |
Output is correct |
31 |
Correct |
9 ms |
6272 KB |
Output is correct |
32 |
Correct |
13 ms |
6272 KB |
Output is correct |
33 |
Correct |
11 ms |
6292 KB |
Output is correct |
34 |
Correct |
9 ms |
6400 KB |
Output is correct |
35 |
Correct |
9 ms |
6272 KB |
Output is correct |
36 |
Correct |
9 ms |
6632 KB |
Output is correct |
37 |
Correct |
9 ms |
6632 KB |
Output is correct |
38 |
Correct |
8 ms |
6288 KB |
Output is correct |
39 |
Correct |
8 ms |
6600 KB |
Output is correct |
40 |
Correct |
9 ms |
6624 KB |
Output is correct |
41 |
Correct |
9 ms |
6296 KB |
Output is correct |
42 |
Correct |
14 ms |
6272 KB |
Output is correct |
43 |
Correct |
9 ms |
6636 KB |
Output is correct |
44 |
Correct |
10 ms |
6224 KB |
Output is correct |
45 |
Correct |
10 ms |
6400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
504 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
508 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 |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 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 |
504 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
11 ms |
592 KB |
Output is correct |
17 |
Correct |
10 ms |
592 KB |
Output is correct |
18 |
Correct |
11 ms |
592 KB |
Output is correct |
19 |
Correct |
11 ms |
592 KB |
Output is correct |
20 |
Correct |
16 ms |
604 KB |
Output is correct |
21 |
Correct |
10 ms |
768 KB |
Output is correct |
22 |
Correct |
10 ms |
592 KB |
Output is correct |
23 |
Correct |
18 ms |
592 KB |
Output is correct |
24 |
Correct |
16 ms |
608 KB |
Output is correct |
25 |
Correct |
10 ms |
592 KB |
Output is correct |
26 |
Correct |
11 ms |
592 KB |
Output is correct |
27 |
Correct |
12 ms |
592 KB |
Output is correct |
28 |
Correct |
10 ms |
592 KB |
Output is correct |
29 |
Correct |
13 ms |
592 KB |
Output is correct |
30 |
Correct |
16 ms |
592 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
504 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
508 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 |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 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 |
504 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 |
508 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 |
336 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 |
504 KB |
Output is correct |
31 |
Correct |
11 ms |
592 KB |
Output is correct |
32 |
Correct |
10 ms |
592 KB |
Output is correct |
33 |
Correct |
11 ms |
592 KB |
Output is correct |
34 |
Correct |
11 ms |
592 KB |
Output is correct |
35 |
Correct |
16 ms |
604 KB |
Output is correct |
36 |
Correct |
10 ms |
768 KB |
Output is correct |
37 |
Correct |
10 ms |
592 KB |
Output is correct |
38 |
Correct |
18 ms |
592 KB |
Output is correct |
39 |
Correct |
16 ms |
608 KB |
Output is correct |
40 |
Correct |
10 ms |
592 KB |
Output is correct |
41 |
Correct |
11 ms |
592 KB |
Output is correct |
42 |
Correct |
12 ms |
592 KB |
Output is correct |
43 |
Correct |
10 ms |
592 KB |
Output is correct |
44 |
Correct |
13 ms |
592 KB |
Output is correct |
45 |
Correct |
16 ms |
592 KB |
Output is correct |
46 |
Correct |
17 ms |
596 KB |
Output is correct |
47 |
Correct |
11 ms |
592 KB |
Output is correct |
48 |
Correct |
10 ms |
592 KB |
Output is correct |
49 |
Correct |
13 ms |
592 KB |
Output is correct |
50 |
Correct |
10 ms |
592 KB |
Output is correct |
51 |
Correct |
10 ms |
592 KB |
Output is correct |
52 |
Correct |
10 ms |
592 KB |
Output is correct |
53 |
Correct |
10 ms |
528 KB |
Output is correct |
54 |
Correct |
10 ms |
592 KB |
Output is correct |
55 |
Correct |
10 ms |
592 KB |
Output is correct |
56 |
Correct |
10 ms |
760 KB |
Output is correct |
57 |
Correct |
10 ms |
768 KB |
Output is correct |
58 |
Correct |
10 ms |
592 KB |
Output is correct |
59 |
Correct |
10 ms |
592 KB |
Output is correct |
60 |
Correct |
10 ms |
784 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
504 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
508 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 |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 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 |
504 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 |
508 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 |
336 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 |
504 KB |
Output is correct |
31 |
Correct |
9 ms |
6272 KB |
Output is correct |
32 |
Correct |
13 ms |
6272 KB |
Output is correct |
33 |
Correct |
11 ms |
6292 KB |
Output is correct |
34 |
Correct |
9 ms |
6400 KB |
Output is correct |
35 |
Correct |
9 ms |
6272 KB |
Output is correct |
36 |
Correct |
9 ms |
6632 KB |
Output is correct |
37 |
Correct |
9 ms |
6632 KB |
Output is correct |
38 |
Correct |
8 ms |
6288 KB |
Output is correct |
39 |
Correct |
8 ms |
6600 KB |
Output is correct |
40 |
Correct |
9 ms |
6624 KB |
Output is correct |
41 |
Correct |
9 ms |
6296 KB |
Output is correct |
42 |
Correct |
14 ms |
6272 KB |
Output is correct |
43 |
Correct |
9 ms |
6636 KB |
Output is correct |
44 |
Correct |
10 ms |
6224 KB |
Output is correct |
45 |
Correct |
10 ms |
6400 KB |
Output is correct |
46 |
Correct |
11 ms |
592 KB |
Output is correct |
47 |
Correct |
10 ms |
592 KB |
Output is correct |
48 |
Correct |
11 ms |
592 KB |
Output is correct |
49 |
Correct |
11 ms |
592 KB |
Output is correct |
50 |
Correct |
16 ms |
604 KB |
Output is correct |
51 |
Correct |
10 ms |
768 KB |
Output is correct |
52 |
Correct |
10 ms |
592 KB |
Output is correct |
53 |
Correct |
18 ms |
592 KB |
Output is correct |
54 |
Correct |
16 ms |
608 KB |
Output is correct |
55 |
Correct |
10 ms |
592 KB |
Output is correct |
56 |
Correct |
11 ms |
592 KB |
Output is correct |
57 |
Correct |
12 ms |
592 KB |
Output is correct |
58 |
Correct |
10 ms |
592 KB |
Output is correct |
59 |
Correct |
13 ms |
592 KB |
Output is correct |
60 |
Correct |
16 ms |
592 KB |
Output is correct |
61 |
Correct |
17 ms |
596 KB |
Output is correct |
62 |
Correct |
11 ms |
592 KB |
Output is correct |
63 |
Correct |
10 ms |
592 KB |
Output is correct |
64 |
Correct |
13 ms |
592 KB |
Output is correct |
65 |
Correct |
10 ms |
592 KB |
Output is correct |
66 |
Correct |
10 ms |
592 KB |
Output is correct |
67 |
Correct |
10 ms |
592 KB |
Output is correct |
68 |
Correct |
10 ms |
528 KB |
Output is correct |
69 |
Correct |
10 ms |
592 KB |
Output is correct |
70 |
Correct |
10 ms |
592 KB |
Output is correct |
71 |
Correct |
10 ms |
760 KB |
Output is correct |
72 |
Correct |
10 ms |
768 KB |
Output is correct |
73 |
Correct |
10 ms |
592 KB |
Output is correct |
74 |
Correct |
10 ms |
592 KB |
Output is correct |
75 |
Correct |
10 ms |
784 KB |
Output is correct |
76 |
Correct |
131 ms |
10876 KB |
Output is correct |
77 |
Correct |
130 ms |
9688 KB |
Output is correct |
78 |
Correct |
152 ms |
15004 KB |
Output is correct |
79 |
Correct |
143 ms |
15028 KB |
Output is correct |
80 |
Correct |
154 ms |
14964 KB |
Output is correct |
81 |
Correct |
158 ms |
9336 KB |
Output is correct |
82 |
Correct |
145 ms |
9340 KB |
Output is correct |
83 |
Correct |
171 ms |
14976 KB |
Output is correct |
84 |
Correct |
172 ms |
14908 KB |
Output is correct |
85 |
Correct |
152 ms |
14968 KB |
Output is correct |
86 |
Correct |
146 ms |
15336 KB |
Output is correct |
87 |
Correct |
165 ms |
15320 KB |
Output is correct |
88 |
Correct |
156 ms |
15328 KB |
Output is correct |
89 |
Correct |
149 ms |
14968 KB |
Output is correct |
90 |
Correct |
171 ms |
15344 KB |
Output is correct |