#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define int long long int
//#define endl '\n'
#define N 150100
#define M 15
#define big 2147483647
#define bigg 9223372036854775807
#define pb push_back
#define p push
#define ins insert
#define f first
char sayi(char a,int x){
if(x>=0){
while(x--){
if(a=='z')a='a';
else a++;
}
return a;
}
while(x++){
if(a=='a')a='z';
else a--;
}
return a;
}
signed main(){
lalala;
int n,q;cin>>n>>q;
string str,hedef;cin>>str>>hedef;
string yedek=str;
for(int i=0;i<(int)yedek.size()-1;i++){
while(yedek[i]!=hedef[i]){
if(yedek[i]=='z')yedek[i]='a';
else yedek[i]++;
if(yedek[i+1]=='z')yedek[i+1]='a';
else yedek[i+1]++;
}
}
//str[n-1]=yedek[n-1];
if(yedek[n-1]!=hedef[n-1])cout<<"ne"<<endl;
else cout<<"da"<<endl;
//cout<<str[n-1]<<endl;
while(q--){
int x;char a;cin>>x>>a;
x--;
str[x]=a;
yedek=str;
for(int i=0;i<(int)yedek.size()-1;i++){
while(yedek[i]!=hedef[i]){
if(yedek[i]=='z')yedek[i]='a';
else yedek[i]++;
if(yedek[i+1]=='z')yedek[i+1]='a';
else yedek[i+1]++;
}
}
if(yedek[n-1]!=hedef[n-1])cout<<"ne"<<endl;
else cout<<"da"<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
452 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
452 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 |
1 ms |
344 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 |
348 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 |
456 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
452 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 |
1 ms |
344 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 |
348 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 |
456 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
58 ms |
4784 KB |
Output is correct |
32 |
Correct |
53 ms |
4788 KB |
Output is correct |
33 |
Correct |
51 ms |
4636 KB |
Output is correct |
34 |
Correct |
53 ms |
4752 KB |
Output is correct |
35 |
Correct |
49 ms |
4796 KB |
Output is correct |
36 |
Correct |
50 ms |
4924 KB |
Output is correct |
37 |
Correct |
48 ms |
5172 KB |
Output is correct |
38 |
Correct |
52 ms |
4792 KB |
Output is correct |
39 |
Correct |
50 ms |
5168 KB |
Output is correct |
40 |
Correct |
50 ms |
5164 KB |
Output is correct |
41 |
Correct |
49 ms |
4752 KB |
Output is correct |
42 |
Correct |
56 ms |
4732 KB |
Output is correct |
43 |
Correct |
49 ms |
5100 KB |
Output is correct |
44 |
Correct |
53 ms |
4812 KB |
Output is correct |
45 |
Correct |
49 ms |
4760 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
452 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 |
119 ms |
928 KB |
Output is correct |
17 |
Correct |
142 ms |
1108 KB |
Output is correct |
18 |
Correct |
127 ms |
1204 KB |
Output is correct |
19 |
Correct |
143 ms |
1108 KB |
Output is correct |
20 |
Correct |
143 ms |
1104 KB |
Output is correct |
21 |
Correct |
124 ms |
1104 KB |
Output is correct |
22 |
Correct |
155 ms |
1108 KB |
Output is correct |
23 |
Correct |
120 ms |
892 KB |
Output is correct |
24 |
Correct |
130 ms |
1092 KB |
Output is correct |
25 |
Correct |
122 ms |
924 KB |
Output is correct |
26 |
Correct |
147 ms |
1108 KB |
Output is correct |
27 |
Correct |
125 ms |
1024 KB |
Output is correct |
28 |
Correct |
119 ms |
1108 KB |
Output is correct |
29 |
Correct |
128 ms |
1100 KB |
Output is correct |
30 |
Correct |
119 ms |
1108 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
452 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 |
1 ms |
344 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 |
348 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 |
456 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
119 ms |
928 KB |
Output is correct |
32 |
Correct |
142 ms |
1108 KB |
Output is correct |
33 |
Correct |
127 ms |
1204 KB |
Output is correct |
34 |
Correct |
143 ms |
1108 KB |
Output is correct |
35 |
Correct |
143 ms |
1104 KB |
Output is correct |
36 |
Correct |
124 ms |
1104 KB |
Output is correct |
37 |
Correct |
155 ms |
1108 KB |
Output is correct |
38 |
Correct |
120 ms |
892 KB |
Output is correct |
39 |
Correct |
130 ms |
1092 KB |
Output is correct |
40 |
Correct |
122 ms |
924 KB |
Output is correct |
41 |
Correct |
147 ms |
1108 KB |
Output is correct |
42 |
Correct |
125 ms |
1024 KB |
Output is correct |
43 |
Correct |
119 ms |
1108 KB |
Output is correct |
44 |
Correct |
128 ms |
1100 KB |
Output is correct |
45 |
Correct |
119 ms |
1108 KB |
Output is correct |
46 |
Execution timed out |
1066 ms |
748 KB |
Time limit exceeded |
47 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
452 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 |
1 ms |
344 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 |
348 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 |
456 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
58 ms |
4784 KB |
Output is correct |
32 |
Correct |
53 ms |
4788 KB |
Output is correct |
33 |
Correct |
51 ms |
4636 KB |
Output is correct |
34 |
Correct |
53 ms |
4752 KB |
Output is correct |
35 |
Correct |
49 ms |
4796 KB |
Output is correct |
36 |
Correct |
50 ms |
4924 KB |
Output is correct |
37 |
Correct |
48 ms |
5172 KB |
Output is correct |
38 |
Correct |
52 ms |
4792 KB |
Output is correct |
39 |
Correct |
50 ms |
5168 KB |
Output is correct |
40 |
Correct |
50 ms |
5164 KB |
Output is correct |
41 |
Correct |
49 ms |
4752 KB |
Output is correct |
42 |
Correct |
56 ms |
4732 KB |
Output is correct |
43 |
Correct |
49 ms |
5100 KB |
Output is correct |
44 |
Correct |
53 ms |
4812 KB |
Output is correct |
45 |
Correct |
49 ms |
4760 KB |
Output is correct |
46 |
Correct |
119 ms |
928 KB |
Output is correct |
47 |
Correct |
142 ms |
1108 KB |
Output is correct |
48 |
Correct |
127 ms |
1204 KB |
Output is correct |
49 |
Correct |
143 ms |
1108 KB |
Output is correct |
50 |
Correct |
143 ms |
1104 KB |
Output is correct |
51 |
Correct |
124 ms |
1104 KB |
Output is correct |
52 |
Correct |
155 ms |
1108 KB |
Output is correct |
53 |
Correct |
120 ms |
892 KB |
Output is correct |
54 |
Correct |
130 ms |
1092 KB |
Output is correct |
55 |
Correct |
122 ms |
924 KB |
Output is correct |
56 |
Correct |
147 ms |
1108 KB |
Output is correct |
57 |
Correct |
125 ms |
1024 KB |
Output is correct |
58 |
Correct |
119 ms |
1108 KB |
Output is correct |
59 |
Correct |
128 ms |
1100 KB |
Output is correct |
60 |
Correct |
119 ms |
1108 KB |
Output is correct |
61 |
Execution timed out |
1066 ms |
748 KB |
Time limit exceeded |
62 |
Halted |
0 ms |
0 KB |
- |