#include <bits/stdc++.h>
#define pb push_back
#define int long long
using namespace std;
const int inf = 1e9 + 10;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n, q;
cin>>n>>q;
string a, b;
cin>>a>>b;
vector<int> delt(n), tot(2);
for(int i = 0; i < n; i++){
delt[i] = a[i] - b[i];
if(delt[i] < 0) delt[i] += 26;
tot[i%2] = (tot[i%2] + delt[i])%26;
}
if(tot[0] == tot[1]) cout<<"da"<<"\n";
else cout<<"ne"<<"\n";
while(q--){
int ind;
char c;
cin>>ind>>c;
ind--;
tot[ind%2] -= delt[ind];
tot[ind%2] = (tot[ind%2] + 26)%26;
a[ind] = c;
delt[ind] = a[ind] - b[ind];
if(delt[ind] < 0) delt[ind] += 26;
tot[ind%2] += delt[ind];
tot[ind%2] %= 26;
if(tot[0] == tot[1]) cout<<"da"<<"\n";
else cout<<"ne"<<"\n";
}
return 0;
}
# |
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 |
504 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 |
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 |
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 |
504 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 |
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 |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
504 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 |
336 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 |
504 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 |
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 |
504 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 |
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 |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
504 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 |
336 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 |
504 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 |
336 KB |
Output is correct |
31 |
Correct |
12 ms |
10280 KB |
Output is correct |
32 |
Correct |
14 ms |
10112 KB |
Output is correct |
33 |
Correct |
13 ms |
10144 KB |
Output is correct |
34 |
Correct |
17 ms |
10192 KB |
Output is correct |
35 |
Correct |
15 ms |
10368 KB |
Output is correct |
36 |
Correct |
14 ms |
10728 KB |
Output is correct |
37 |
Correct |
13 ms |
10728 KB |
Output is correct |
38 |
Correct |
14 ms |
10128 KB |
Output is correct |
39 |
Correct |
14 ms |
10732 KB |
Output is correct |
40 |
Correct |
12 ms |
10720 KB |
Output is correct |
41 |
Correct |
12 ms |
10492 KB |
Output is correct |
42 |
Correct |
12 ms |
10112 KB |
Output is correct |
43 |
Correct |
15 ms |
10744 KB |
Output is correct |
44 |
Correct |
12 ms |
10144 KB |
Output is correct |
45 |
Correct |
18 ms |
10380 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 |
504 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 |
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 |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
10 ms |
592 KB |
Output is correct |
17 |
Correct |
11 ms |
760 KB |
Output is correct |
18 |
Correct |
10 ms |
760 KB |
Output is correct |
19 |
Correct |
11 ms |
592 KB |
Output is correct |
20 |
Correct |
10 ms |
592 KB |
Output is correct |
21 |
Correct |
9 ms |
592 KB |
Output is correct |
22 |
Correct |
10 ms |
592 KB |
Output is correct |
23 |
Correct |
10 ms |
592 KB |
Output is correct |
24 |
Correct |
11 ms |
592 KB |
Output is correct |
25 |
Correct |
11 ms |
508 KB |
Output is correct |
26 |
Correct |
12 ms |
708 KB |
Output is correct |
27 |
Correct |
13 ms |
592 KB |
Output is correct |
28 |
Correct |
10 ms |
592 KB |
Output is correct |
29 |
Correct |
10 ms |
744 KB |
Output is correct |
30 |
Correct |
10 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 |
504 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 |
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 |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
504 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 |
336 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 |
504 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 |
336 KB |
Output is correct |
31 |
Correct |
10 ms |
592 KB |
Output is correct |
32 |
Correct |
11 ms |
760 KB |
Output is correct |
33 |
Correct |
10 ms |
760 KB |
Output is correct |
34 |
Correct |
11 ms |
592 KB |
Output is correct |
35 |
Correct |
10 ms |
592 KB |
Output is correct |
36 |
Correct |
9 ms |
592 KB |
Output is correct |
37 |
Correct |
10 ms |
592 KB |
Output is correct |
38 |
Correct |
10 ms |
592 KB |
Output is correct |
39 |
Correct |
11 ms |
592 KB |
Output is correct |
40 |
Correct |
11 ms |
508 KB |
Output is correct |
41 |
Correct |
12 ms |
708 KB |
Output is correct |
42 |
Correct |
13 ms |
592 KB |
Output is correct |
43 |
Correct |
10 ms |
592 KB |
Output is correct |
44 |
Correct |
10 ms |
744 KB |
Output is correct |
45 |
Correct |
10 ms |
592 KB |
Output is correct |
46 |
Correct |
11 ms |
592 KB |
Output is correct |
47 |
Correct |
11 ms |
620 KB |
Output is correct |
48 |
Correct |
11 ms |
592 KB |
Output is correct |
49 |
Correct |
17 ms |
592 KB |
Output is correct |
50 |
Correct |
12 ms |
592 KB |
Output is correct |
51 |
Correct |
11 ms |
592 KB |
Output is correct |
52 |
Correct |
11 ms |
592 KB |
Output is correct |
53 |
Correct |
16 ms |
536 KB |
Output is correct |
54 |
Correct |
12 ms |
592 KB |
Output is correct |
55 |
Correct |
14 ms |
592 KB |
Output is correct |
56 |
Correct |
12 ms |
760 KB |
Output is correct |
57 |
Correct |
11 ms |
592 KB |
Output is correct |
58 |
Correct |
14 ms |
592 KB |
Output is correct |
59 |
Correct |
12 ms |
592 KB |
Output is correct |
60 |
Correct |
12 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 |
504 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 |
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 |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
504 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 |
336 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 |
504 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 |
336 KB |
Output is correct |
31 |
Correct |
12 ms |
10280 KB |
Output is correct |
32 |
Correct |
14 ms |
10112 KB |
Output is correct |
33 |
Correct |
13 ms |
10144 KB |
Output is correct |
34 |
Correct |
17 ms |
10192 KB |
Output is correct |
35 |
Correct |
15 ms |
10368 KB |
Output is correct |
36 |
Correct |
14 ms |
10728 KB |
Output is correct |
37 |
Correct |
13 ms |
10728 KB |
Output is correct |
38 |
Correct |
14 ms |
10128 KB |
Output is correct |
39 |
Correct |
14 ms |
10732 KB |
Output is correct |
40 |
Correct |
12 ms |
10720 KB |
Output is correct |
41 |
Correct |
12 ms |
10492 KB |
Output is correct |
42 |
Correct |
12 ms |
10112 KB |
Output is correct |
43 |
Correct |
15 ms |
10744 KB |
Output is correct |
44 |
Correct |
12 ms |
10144 KB |
Output is correct |
45 |
Correct |
18 ms |
10380 KB |
Output is correct |
46 |
Correct |
10 ms |
592 KB |
Output is correct |
47 |
Correct |
11 ms |
760 KB |
Output is correct |
48 |
Correct |
10 ms |
760 KB |
Output is correct |
49 |
Correct |
11 ms |
592 KB |
Output is correct |
50 |
Correct |
10 ms |
592 KB |
Output is correct |
51 |
Correct |
9 ms |
592 KB |
Output is correct |
52 |
Correct |
10 ms |
592 KB |
Output is correct |
53 |
Correct |
10 ms |
592 KB |
Output is correct |
54 |
Correct |
11 ms |
592 KB |
Output is correct |
55 |
Correct |
11 ms |
508 KB |
Output is correct |
56 |
Correct |
12 ms |
708 KB |
Output is correct |
57 |
Correct |
13 ms |
592 KB |
Output is correct |
58 |
Correct |
10 ms |
592 KB |
Output is correct |
59 |
Correct |
10 ms |
744 KB |
Output is correct |
60 |
Correct |
10 ms |
592 KB |
Output is correct |
61 |
Correct |
11 ms |
592 KB |
Output is correct |
62 |
Correct |
11 ms |
620 KB |
Output is correct |
63 |
Correct |
11 ms |
592 KB |
Output is correct |
64 |
Correct |
17 ms |
592 KB |
Output is correct |
65 |
Correct |
12 ms |
592 KB |
Output is correct |
66 |
Correct |
11 ms |
592 KB |
Output is correct |
67 |
Correct |
11 ms |
592 KB |
Output is correct |
68 |
Correct |
16 ms |
536 KB |
Output is correct |
69 |
Correct |
12 ms |
592 KB |
Output is correct |
70 |
Correct |
14 ms |
592 KB |
Output is correct |
71 |
Correct |
12 ms |
760 KB |
Output is correct |
72 |
Correct |
11 ms |
592 KB |
Output is correct |
73 |
Correct |
14 ms |
592 KB |
Output is correct |
74 |
Correct |
12 ms |
592 KB |
Output is correct |
75 |
Correct |
12 ms |
592 KB |
Output is correct |
76 |
Correct |
149 ms |
16248 KB |
Output is correct |
77 |
Correct |
189 ms |
24280 KB |
Output is correct |
78 |
Correct |
150 ms |
24024 KB |
Output is correct |
79 |
Correct |
157 ms |
23928 KB |
Output is correct |
80 |
Correct |
151 ms |
23932 KB |
Output is correct |
81 |
Correct |
160 ms |
23924 KB |
Output is correct |
82 |
Correct |
188 ms |
23936 KB |
Output is correct |
83 |
Correct |
172 ms |
23892 KB |
Output is correct |
84 |
Correct |
162 ms |
23936 KB |
Output is correct |
85 |
Correct |
162 ms |
23932 KB |
Output is correct |
86 |
Correct |
149 ms |
24168 KB |
Output is correct |
87 |
Correct |
153 ms |
24348 KB |
Output is correct |
88 |
Correct |
191 ms |
24288 KB |
Output is correct |
89 |
Correct |
215 ms |
23948 KB |
Output is correct |
90 |
Correct |
220 ms |
24248 KB |
Output is correct |