// HELLNAH 2
#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;
int sum=0;
for(int i=0;i<n;i++){
sum=(-sum + t[i]-s[i] + 26)%26;
}
cout<<(sum? "ne":"da")<<endl;
while(q--){
int idx;
cin>>idx;
char c;
cin>>c;
int diff = c - s[--idx];
s[idx]=c;
sum= (sum+26 + diff + ( (n-idx)&1) * -2 * diff )%26;
/* ala bu tek cut sohbet i seye gore imis
tek olanda : -d +d -d +d -d
^ last
cut olanda : -d +d -d +d
^ last
*/
cout<<(sum? "ne":"da")<<endl;
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int tt = 1;
// cin>>tt;
while(tt--){
rush();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
444 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 |
460 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 |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
444 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 |
460 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 |
464 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
504 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 |
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 |
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 |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
444 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 |
460 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 |
464 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
504 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 |
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 |
504 KB |
Output is correct |
31 |
Correct |
10 ms |
4588 KB |
Output is correct |
32 |
Correct |
10 ms |
4588 KB |
Output is correct |
33 |
Correct |
9 ms |
2796 KB |
Output is correct |
34 |
Correct |
10 ms |
4456 KB |
Output is correct |
35 |
Correct |
10 ms |
4588 KB |
Output is correct |
36 |
Correct |
9 ms |
2796 KB |
Output is correct |
37 |
Correct |
9 ms |
2796 KB |
Output is correct |
38 |
Correct |
9 ms |
2796 KB |
Output is correct |
39 |
Correct |
10 ms |
4884 KB |
Output is correct |
40 |
Correct |
8 ms |
2796 KB |
Output is correct |
41 |
Correct |
8 ms |
2780 KB |
Output is correct |
42 |
Correct |
11 ms |
4332 KB |
Output is correct |
43 |
Correct |
9 ms |
2964 KB |
Output is correct |
44 |
Correct |
10 ms |
4332 KB |
Output is correct |
45 |
Correct |
10 ms |
4332 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 |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
444 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 |
460 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
8 ms |
680 KB |
Output is correct |
17 |
Correct |
8 ms |
1104 KB |
Output is correct |
18 |
Correct |
8 ms |
848 KB |
Output is correct |
19 |
Correct |
9 ms |
1104 KB |
Output is correct |
20 |
Correct |
9 ms |
1104 KB |
Output is correct |
21 |
Correct |
8 ms |
1104 KB |
Output is correct |
22 |
Correct |
9 ms |
1272 KB |
Output is correct |
23 |
Correct |
8 ms |
592 KB |
Output is correct |
24 |
Correct |
8 ms |
592 KB |
Output is correct |
25 |
Correct |
8 ms |
1104 KB |
Output is correct |
26 |
Correct |
8 ms |
1104 KB |
Output is correct |
27 |
Correct |
9 ms |
1104 KB |
Output is correct |
28 |
Correct |
9 ms |
1104 KB |
Output is correct |
29 |
Correct |
9 ms |
1104 KB |
Output is correct |
30 |
Correct |
8 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 |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
444 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 |
460 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 |
464 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
504 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 |
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 |
504 KB |
Output is correct |
31 |
Correct |
8 ms |
680 KB |
Output is correct |
32 |
Correct |
8 ms |
1104 KB |
Output is correct |
33 |
Correct |
8 ms |
848 KB |
Output is correct |
34 |
Correct |
9 ms |
1104 KB |
Output is correct |
35 |
Correct |
9 ms |
1104 KB |
Output is correct |
36 |
Correct |
8 ms |
1104 KB |
Output is correct |
37 |
Correct |
9 ms |
1272 KB |
Output is correct |
38 |
Correct |
8 ms |
592 KB |
Output is correct |
39 |
Correct |
8 ms |
592 KB |
Output is correct |
40 |
Correct |
8 ms |
1104 KB |
Output is correct |
41 |
Correct |
8 ms |
1104 KB |
Output is correct |
42 |
Correct |
9 ms |
1104 KB |
Output is correct |
43 |
Correct |
9 ms |
1104 KB |
Output is correct |
44 |
Correct |
9 ms |
1104 KB |
Output is correct |
45 |
Correct |
8 ms |
592 KB |
Output is correct |
46 |
Correct |
10 ms |
1104 KB |
Output is correct |
47 |
Correct |
11 ms |
1272 KB |
Output is correct |
48 |
Correct |
9 ms |
1104 KB |
Output is correct |
49 |
Correct |
9 ms |
1104 KB |
Output is correct |
50 |
Correct |
9 ms |
592 KB |
Output is correct |
51 |
Correct |
9 ms |
1104 KB |
Output is correct |
52 |
Correct |
10 ms |
592 KB |
Output is correct |
53 |
Correct |
13 ms |
1104 KB |
Output is correct |
54 |
Correct |
10 ms |
1104 KB |
Output is correct |
55 |
Correct |
10 ms |
1272 KB |
Output is correct |
56 |
Correct |
9 ms |
1104 KB |
Output is correct |
57 |
Correct |
9 ms |
592 KB |
Output is correct |
58 |
Correct |
9 ms |
760 KB |
Output is correct |
59 |
Correct |
13 ms |
1104 KB |
Output is correct |
60 |
Correct |
10 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 |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
444 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 |
460 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 |
464 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
504 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 |
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 |
504 KB |
Output is correct |
31 |
Correct |
10 ms |
4588 KB |
Output is correct |
32 |
Correct |
10 ms |
4588 KB |
Output is correct |
33 |
Correct |
9 ms |
2796 KB |
Output is correct |
34 |
Correct |
10 ms |
4456 KB |
Output is correct |
35 |
Correct |
10 ms |
4588 KB |
Output is correct |
36 |
Correct |
9 ms |
2796 KB |
Output is correct |
37 |
Correct |
9 ms |
2796 KB |
Output is correct |
38 |
Correct |
9 ms |
2796 KB |
Output is correct |
39 |
Correct |
10 ms |
4884 KB |
Output is correct |
40 |
Correct |
8 ms |
2796 KB |
Output is correct |
41 |
Correct |
8 ms |
2780 KB |
Output is correct |
42 |
Correct |
11 ms |
4332 KB |
Output is correct |
43 |
Correct |
9 ms |
2964 KB |
Output is correct |
44 |
Correct |
10 ms |
4332 KB |
Output is correct |
45 |
Correct |
10 ms |
4332 KB |
Output is correct |
46 |
Correct |
8 ms |
680 KB |
Output is correct |
47 |
Correct |
8 ms |
1104 KB |
Output is correct |
48 |
Correct |
8 ms |
848 KB |
Output is correct |
49 |
Correct |
9 ms |
1104 KB |
Output is correct |
50 |
Correct |
9 ms |
1104 KB |
Output is correct |
51 |
Correct |
8 ms |
1104 KB |
Output is correct |
52 |
Correct |
9 ms |
1272 KB |
Output is correct |
53 |
Correct |
8 ms |
592 KB |
Output is correct |
54 |
Correct |
8 ms |
592 KB |
Output is correct |
55 |
Correct |
8 ms |
1104 KB |
Output is correct |
56 |
Correct |
8 ms |
1104 KB |
Output is correct |
57 |
Correct |
9 ms |
1104 KB |
Output is correct |
58 |
Correct |
9 ms |
1104 KB |
Output is correct |
59 |
Correct |
9 ms |
1104 KB |
Output is correct |
60 |
Correct |
8 ms |
592 KB |
Output is correct |
61 |
Correct |
10 ms |
1104 KB |
Output is correct |
62 |
Correct |
11 ms |
1272 KB |
Output is correct |
63 |
Correct |
9 ms |
1104 KB |
Output is correct |
64 |
Correct |
9 ms |
1104 KB |
Output is correct |
65 |
Correct |
9 ms |
592 KB |
Output is correct |
66 |
Correct |
9 ms |
1104 KB |
Output is correct |
67 |
Correct |
10 ms |
592 KB |
Output is correct |
68 |
Correct |
13 ms |
1104 KB |
Output is correct |
69 |
Correct |
10 ms |
1104 KB |
Output is correct |
70 |
Correct |
10 ms |
1272 KB |
Output is correct |
71 |
Correct |
9 ms |
1104 KB |
Output is correct |
72 |
Correct |
9 ms |
592 KB |
Output is correct |
73 |
Correct |
9 ms |
760 KB |
Output is correct |
74 |
Correct |
13 ms |
1104 KB |
Output is correct |
75 |
Correct |
10 ms |
592 KB |
Output is correct |
76 |
Correct |
132 ms |
15972 KB |
Output is correct |
77 |
Correct |
129 ms |
14348 KB |
Output is correct |
78 |
Correct |
114 ms |
5528 KB |
Output is correct |
79 |
Correct |
110 ms |
5324 KB |
Output is correct |
80 |
Correct |
125 ms |
15992 KB |
Output is correct |
81 |
Correct |
123 ms |
10124 KB |
Output is correct |
82 |
Correct |
124 ms |
15228 KB |
Output is correct |
83 |
Correct |
120 ms |
15236 KB |
Output is correct |
84 |
Correct |
108 ms |
5496 KB |
Output is correct |
85 |
Correct |
108 ms |
5496 KB |
Output is correct |
86 |
Correct |
116 ms |
15584 KB |
Output is correct |
87 |
Correct |
113 ms |
16088 KB |
Output is correct |
88 |
Correct |
119 ms |
16348 KB |
Output is correct |
89 |
Correct |
113 ms |
15988 KB |
Output is correct |
90 |
Correct |
114 ms |
14296 KB |
Output is correct |