// HELLLLLLLNAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ins insert
#define pb push_back
#define endl '\n'
#define putr(x) cout<<x<<endl;return;
#define all(x) x.begin(),x.end()
const int mod = 1e9 +7, sze = 1e5 +5, inf = INT_MAX, LL = 30;
void rush(){
int n,q;
cin>>n>>q;
string s,t;
cin>>s>>t;
vector<int> pref(n,0);
for(int i=0;i<n;i++){
pref[i]=(t[i]-s[i] + 26)%26;
if(i){
pref[i]=(-pref[i-1] + pref[i] + 26)%26;
}
}
if(pref.back()==0){
cout<<"da\n";
}
else{
cout<<"ne\n";
}
int tot = 0;
while(q--){
int idx;
cin>>idx;
char c;
cin>>c;
--idx;
int diff = c - s[idx];
// cout<<diff<<endl;
s[idx]=c;
if((n-idx)&1){
pref.back()=(pref.back() + 26 - diff)%26;
}
else{
pref.back()=(pref.back() + diff + 26)%26;
}
if(pref.back()==0){
cout<<"da\n";
}
else{
cout<<"ne\n";
}
}
/*
amelelik :
ab | bb
pref: 1 25
2 a , -1, b->b, b->a->b
perf : 1 0
ferq tek olanda, last positiona tesir elemir
1 b : 1, aa -. ba
pref : 0,1
*/
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int tt = 1;
// cin>>tt;
while(tt--){
rush();
}
return 0;
}
Compilation message
Main.cpp: In function 'void rush()':
Main.cpp:30:9: warning: unused variable 'tot' [-Wunused-variable]
30 | int tot = 0;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 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 |
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 |
0 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 |
504 KB |
Output is correct |
25 |
Correct |
1 ms |
504 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 |
504 KB |
Output is correct |
29 |
Correct |
1 ms |
380 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 |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 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 |
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 |
0 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 |
504 KB |
Output is correct |
25 |
Correct |
1 ms |
504 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 |
504 KB |
Output is correct |
29 |
Correct |
1 ms |
380 KB |
Output is correct |
30 |
Correct |
1 ms |
504 KB |
Output is correct |
31 |
Correct |
10 ms |
10112 KB |
Output is correct |
32 |
Correct |
10 ms |
10112 KB |
Output is correct |
33 |
Correct |
10 ms |
10132 KB |
Output is correct |
34 |
Correct |
10 ms |
10128 KB |
Output is correct |
35 |
Correct |
10 ms |
10536 KB |
Output is correct |
36 |
Correct |
10 ms |
10728 KB |
Output is correct |
37 |
Correct |
10 ms |
10728 KB |
Output is correct |
38 |
Correct |
10 ms |
10300 KB |
Output is correct |
39 |
Correct |
10 ms |
10900 KB |
Output is correct |
40 |
Correct |
10 ms |
10720 KB |
Output is correct |
41 |
Correct |
10 ms |
10124 KB |
Output is correct |
42 |
Correct |
10 ms |
10368 KB |
Output is correct |
43 |
Correct |
10 ms |
10732 KB |
Output is correct |
44 |
Correct |
10 ms |
10144 KB |
Output is correct |
45 |
Correct |
10 ms |
10380 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 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 |
8 ms |
592 KB |
Output is correct |
17 |
Correct |
8 ms |
1120 KB |
Output is correct |
18 |
Correct |
10 ms |
1104 KB |
Output is correct |
19 |
Correct |
8 ms |
1120 KB |
Output is correct |
20 |
Correct |
8 ms |
1104 KB |
Output is correct |
21 |
Correct |
8 ms |
1116 KB |
Output is correct |
22 |
Correct |
7 ms |
1104 KB |
Output is correct |
23 |
Correct |
8 ms |
1104 KB |
Output is correct |
24 |
Correct |
8 ms |
1104 KB |
Output is correct |
25 |
Correct |
7 ms |
1104 KB |
Output is correct |
26 |
Correct |
8 ms |
1104 KB |
Output is correct |
27 |
Correct |
8 ms |
1104 KB |
Output is correct |
28 |
Correct |
8 ms |
1104 KB |
Output is correct |
29 |
Correct |
7 ms |
1100 KB |
Output is correct |
30 |
Correct |
11 ms |
1360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 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 |
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 |
0 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 |
504 KB |
Output is correct |
25 |
Correct |
1 ms |
504 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 |
504 KB |
Output is correct |
29 |
Correct |
1 ms |
380 KB |
Output is correct |
30 |
Correct |
1 ms |
504 KB |
Output is correct |
31 |
Correct |
8 ms |
592 KB |
Output is correct |
32 |
Correct |
8 ms |
1120 KB |
Output is correct |
33 |
Correct |
10 ms |
1104 KB |
Output is correct |
34 |
Correct |
8 ms |
1120 KB |
Output is correct |
35 |
Correct |
8 ms |
1104 KB |
Output is correct |
36 |
Correct |
8 ms |
1116 KB |
Output is correct |
37 |
Correct |
7 ms |
1104 KB |
Output is correct |
38 |
Correct |
8 ms |
1104 KB |
Output is correct |
39 |
Correct |
8 ms |
1104 KB |
Output is correct |
40 |
Correct |
7 ms |
1104 KB |
Output is correct |
41 |
Correct |
8 ms |
1104 KB |
Output is correct |
42 |
Correct |
8 ms |
1104 KB |
Output is correct |
43 |
Correct |
8 ms |
1104 KB |
Output is correct |
44 |
Correct |
7 ms |
1100 KB |
Output is correct |
45 |
Correct |
11 ms |
1360 KB |
Output is correct |
46 |
Correct |
9 ms |
1104 KB |
Output is correct |
47 |
Correct |
9 ms |
1104 KB |
Output is correct |
48 |
Correct |
9 ms |
1104 KB |
Output is correct |
49 |
Correct |
9 ms |
1296 KB |
Output is correct |
50 |
Correct |
8 ms |
1104 KB |
Output is correct |
51 |
Correct |
8 ms |
1104 KB |
Output is correct |
52 |
Correct |
9 ms |
1360 KB |
Output is correct |
53 |
Correct |
8 ms |
1280 KB |
Output is correct |
54 |
Correct |
9 ms |
1104 KB |
Output is correct |
55 |
Correct |
8 ms |
1104 KB |
Output is correct |
56 |
Correct |
9 ms |
1104 KB |
Output is correct |
57 |
Correct |
9 ms |
1104 KB |
Output is correct |
58 |
Correct |
15 ms |
1236 KB |
Output is correct |
59 |
Correct |
14 ms |
1372 KB |
Output is correct |
60 |
Correct |
8 ms |
1104 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 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 |
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 |
0 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 |
504 KB |
Output is correct |
25 |
Correct |
1 ms |
504 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 |
504 KB |
Output is correct |
29 |
Correct |
1 ms |
380 KB |
Output is correct |
30 |
Correct |
1 ms |
504 KB |
Output is correct |
31 |
Correct |
10 ms |
10112 KB |
Output is correct |
32 |
Correct |
10 ms |
10112 KB |
Output is correct |
33 |
Correct |
10 ms |
10132 KB |
Output is correct |
34 |
Correct |
10 ms |
10128 KB |
Output is correct |
35 |
Correct |
10 ms |
10536 KB |
Output is correct |
36 |
Correct |
10 ms |
10728 KB |
Output is correct |
37 |
Correct |
10 ms |
10728 KB |
Output is correct |
38 |
Correct |
10 ms |
10300 KB |
Output is correct |
39 |
Correct |
10 ms |
10900 KB |
Output is correct |
40 |
Correct |
10 ms |
10720 KB |
Output is correct |
41 |
Correct |
10 ms |
10124 KB |
Output is correct |
42 |
Correct |
10 ms |
10368 KB |
Output is correct |
43 |
Correct |
10 ms |
10732 KB |
Output is correct |
44 |
Correct |
10 ms |
10144 KB |
Output is correct |
45 |
Correct |
10 ms |
10380 KB |
Output is correct |
46 |
Correct |
8 ms |
592 KB |
Output is correct |
47 |
Correct |
8 ms |
1120 KB |
Output is correct |
48 |
Correct |
10 ms |
1104 KB |
Output is correct |
49 |
Correct |
8 ms |
1120 KB |
Output is correct |
50 |
Correct |
8 ms |
1104 KB |
Output is correct |
51 |
Correct |
8 ms |
1116 KB |
Output is correct |
52 |
Correct |
7 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 |
1104 KB |
Output is correct |
57 |
Correct |
8 ms |
1104 KB |
Output is correct |
58 |
Correct |
8 ms |
1104 KB |
Output is correct |
59 |
Correct |
7 ms |
1100 KB |
Output is correct |
60 |
Correct |
11 ms |
1360 KB |
Output is correct |
61 |
Correct |
9 ms |
1104 KB |
Output is correct |
62 |
Correct |
9 ms |
1104 KB |
Output is correct |
63 |
Correct |
9 ms |
1104 KB |
Output is correct |
64 |
Correct |
9 ms |
1296 KB |
Output is correct |
65 |
Correct |
8 ms |
1104 KB |
Output is correct |
66 |
Correct |
8 ms |
1104 KB |
Output is correct |
67 |
Correct |
9 ms |
1360 KB |
Output is correct |
68 |
Correct |
8 ms |
1280 KB |
Output is correct |
69 |
Correct |
9 ms |
1104 KB |
Output is correct |
70 |
Correct |
8 ms |
1104 KB |
Output is correct |
71 |
Correct |
9 ms |
1104 KB |
Output is correct |
72 |
Correct |
9 ms |
1104 KB |
Output is correct |
73 |
Correct |
15 ms |
1236 KB |
Output is correct |
74 |
Correct |
14 ms |
1372 KB |
Output is correct |
75 |
Correct |
8 ms |
1104 KB |
Output is correct |
76 |
Correct |
113 ms |
23932 KB |
Output is correct |
77 |
Correct |
116 ms |
24280 KB |
Output is correct |
78 |
Correct |
106 ms |
23976 KB |
Output is correct |
79 |
Correct |
110 ms |
23920 KB |
Output is correct |
80 |
Correct |
109 ms |
23960 KB |
Output is correct |
81 |
Correct |
105 ms |
23928 KB |
Output is correct |
82 |
Correct |
106 ms |
23944 KB |
Output is correct |
83 |
Correct |
103 ms |
23936 KB |
Output is correct |
84 |
Correct |
107 ms |
23924 KB |
Output is correct |
85 |
Correct |
104 ms |
23928 KB |
Output is correct |
86 |
Correct |
108 ms |
24300 KB |
Output is correct |
87 |
Correct |
101 ms |
24280 KB |
Output is correct |
88 |
Correct |
101 ms |
24292 KB |
Output is correct |
89 |
Correct |
101 ms |
23924 KB |
Output is correct |
90 |
Correct |
100 ms |
24288 KB |
Output is correct |