// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define db long double
#define vll vector<pll>
#define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
void fmain(){
int n, q;
string s, t;
cin >> n >> q >> s >> t;
int sum = 0;
for(int i = 0; i < n; i++){
sum = (-sum + t[i] - s[i] + 26) % 26;
}
cout << (!sum ? "da" : "ne") << endl;
while(q--){
int idx;
char c;
cin >> idx >> c;
int diff = c - s[idx - 1];
s[idx - 1] = c;
sum = (sum + 26 + diff + (n - idx + 1) % 2 * -2 * diff) % 26;
cout << (!sum ? "da" : "ne") << endl;
}
}
signed main(){
int tmr = 1;
// cin >> tmr;
while(tmr--){
fmain();
}
}
# |
결과 |
실행 시간 |
메모리 |
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 |
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 |
504 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 |
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 |
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 |
504 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 |
504 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 |
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 |
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 |
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 |
504 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 |
504 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 |
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 |
336 KB |
Output is correct |
31 |
Correct |
36 ms |
6264 KB |
Output is correct |
32 |
Correct |
32 ms |
6212 KB |
Output is correct |
33 |
Correct |
32 ms |
6212 KB |
Output is correct |
34 |
Correct |
32 ms |
6012 KB |
Output is correct |
35 |
Correct |
33 ms |
6060 KB |
Output is correct |
36 |
Correct |
33 ms |
6216 KB |
Output is correct |
37 |
Correct |
32 ms |
6212 KB |
Output is correct |
38 |
Correct |
33 ms |
6212 KB |
Output is correct |
39 |
Correct |
33 ms |
6064 KB |
Output is correct |
40 |
Correct |
32 ms |
6204 KB |
Output is correct |
41 |
Correct |
32 ms |
6208 KB |
Output is correct |
42 |
Correct |
34 ms |
6212 KB |
Output is correct |
43 |
Correct |
36 ms |
6212 KB |
Output is correct |
44 |
Correct |
37 ms |
6468 KB |
Output is correct |
45 |
Correct |
36 ms |
6212 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 |
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 |
504 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 |
158 ms |
992 KB |
Output is correct |
17 |
Correct |
155 ms |
1096 KB |
Output is correct |
18 |
Correct |
158 ms |
976 KB |
Output is correct |
19 |
Correct |
155 ms |
1096 KB |
Output is correct |
20 |
Correct |
161 ms |
1096 KB |
Output is correct |
21 |
Correct |
155 ms |
1100 KB |
Output is correct |
22 |
Correct |
156 ms |
1088 KB |
Output is correct |
23 |
Correct |
157 ms |
1096 KB |
Output is correct |
24 |
Correct |
165 ms |
1104 KB |
Output is correct |
25 |
Correct |
155 ms |
1096 KB |
Output is correct |
26 |
Correct |
156 ms |
920 KB |
Output is correct |
27 |
Correct |
156 ms |
1096 KB |
Output is correct |
28 |
Correct |
163 ms |
1096 KB |
Output is correct |
29 |
Correct |
157 ms |
1096 KB |
Output is correct |
30 |
Correct |
156 ms |
1072 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 |
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 |
504 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 |
504 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 |
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 |
336 KB |
Output is correct |
31 |
Correct |
158 ms |
992 KB |
Output is correct |
32 |
Correct |
155 ms |
1096 KB |
Output is correct |
33 |
Correct |
158 ms |
976 KB |
Output is correct |
34 |
Correct |
155 ms |
1096 KB |
Output is correct |
35 |
Correct |
161 ms |
1096 KB |
Output is correct |
36 |
Correct |
155 ms |
1100 KB |
Output is correct |
37 |
Correct |
156 ms |
1088 KB |
Output is correct |
38 |
Correct |
157 ms |
1096 KB |
Output is correct |
39 |
Correct |
165 ms |
1104 KB |
Output is correct |
40 |
Correct |
155 ms |
1096 KB |
Output is correct |
41 |
Correct |
156 ms |
920 KB |
Output is correct |
42 |
Correct |
156 ms |
1096 KB |
Output is correct |
43 |
Correct |
163 ms |
1096 KB |
Output is correct |
44 |
Correct |
157 ms |
1096 KB |
Output is correct |
45 |
Correct |
156 ms |
1072 KB |
Output is correct |
46 |
Correct |
159 ms |
1096 KB |
Output is correct |
47 |
Correct |
174 ms |
1096 KB |
Output is correct |
48 |
Correct |
160 ms |
1100 KB |
Output is correct |
49 |
Correct |
159 ms |
1076 KB |
Output is correct |
50 |
Correct |
168 ms |
1100 KB |
Output is correct |
51 |
Correct |
161 ms |
1096 KB |
Output is correct |
52 |
Correct |
169 ms |
1208 KB |
Output is correct |
53 |
Correct |
160 ms |
1220 KB |
Output is correct |
54 |
Correct |
166 ms |
1096 KB |
Output is correct |
55 |
Correct |
162 ms |
1140 KB |
Output is correct |
56 |
Correct |
160 ms |
1096 KB |
Output is correct |
57 |
Correct |
167 ms |
1096 KB |
Output is correct |
58 |
Correct |
183 ms |
1096 KB |
Output is correct |
59 |
Correct |
170 ms |
1096 KB |
Output is correct |
60 |
Correct |
161 ms |
1132 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 |
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 |
504 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 |
504 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 |
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 |
336 KB |
Output is correct |
31 |
Correct |
36 ms |
6264 KB |
Output is correct |
32 |
Correct |
32 ms |
6212 KB |
Output is correct |
33 |
Correct |
32 ms |
6212 KB |
Output is correct |
34 |
Correct |
32 ms |
6012 KB |
Output is correct |
35 |
Correct |
33 ms |
6060 KB |
Output is correct |
36 |
Correct |
33 ms |
6216 KB |
Output is correct |
37 |
Correct |
32 ms |
6212 KB |
Output is correct |
38 |
Correct |
33 ms |
6212 KB |
Output is correct |
39 |
Correct |
33 ms |
6064 KB |
Output is correct |
40 |
Correct |
32 ms |
6204 KB |
Output is correct |
41 |
Correct |
32 ms |
6208 KB |
Output is correct |
42 |
Correct |
34 ms |
6212 KB |
Output is correct |
43 |
Correct |
36 ms |
6212 KB |
Output is correct |
44 |
Correct |
37 ms |
6468 KB |
Output is correct |
45 |
Correct |
36 ms |
6212 KB |
Output is correct |
46 |
Correct |
158 ms |
992 KB |
Output is correct |
47 |
Correct |
155 ms |
1096 KB |
Output is correct |
48 |
Correct |
158 ms |
976 KB |
Output is correct |
49 |
Correct |
155 ms |
1096 KB |
Output is correct |
50 |
Correct |
161 ms |
1096 KB |
Output is correct |
51 |
Correct |
155 ms |
1100 KB |
Output is correct |
52 |
Correct |
156 ms |
1088 KB |
Output is correct |
53 |
Correct |
157 ms |
1096 KB |
Output is correct |
54 |
Correct |
165 ms |
1104 KB |
Output is correct |
55 |
Correct |
155 ms |
1096 KB |
Output is correct |
56 |
Correct |
156 ms |
920 KB |
Output is correct |
57 |
Correct |
156 ms |
1096 KB |
Output is correct |
58 |
Correct |
163 ms |
1096 KB |
Output is correct |
59 |
Correct |
157 ms |
1096 KB |
Output is correct |
60 |
Correct |
156 ms |
1072 KB |
Output is correct |
61 |
Correct |
159 ms |
1096 KB |
Output is correct |
62 |
Correct |
174 ms |
1096 KB |
Output is correct |
63 |
Correct |
160 ms |
1100 KB |
Output is correct |
64 |
Correct |
159 ms |
1076 KB |
Output is correct |
65 |
Correct |
168 ms |
1100 KB |
Output is correct |
66 |
Correct |
161 ms |
1096 KB |
Output is correct |
67 |
Correct |
169 ms |
1208 KB |
Output is correct |
68 |
Correct |
160 ms |
1220 KB |
Output is correct |
69 |
Correct |
166 ms |
1096 KB |
Output is correct |
70 |
Correct |
162 ms |
1140 KB |
Output is correct |
71 |
Correct |
160 ms |
1096 KB |
Output is correct |
72 |
Correct |
167 ms |
1096 KB |
Output is correct |
73 |
Correct |
183 ms |
1096 KB |
Output is correct |
74 |
Correct |
170 ms |
1096 KB |
Output is correct |
75 |
Correct |
161 ms |
1132 KB |
Output is correct |
76 |
Execution timed out |
1049 ms |
11576 KB |
Time limit exceeded |
77 |
Halted |
0 ms |
0 KB |
- |