#include <bits/stdc++.h>
#define pb push_back
#define int long long
using namespace std;
const int inf = 1e9 + 10;
int modval(int x){
int chl = 26;
int res = (x + 26 * inf)%26;
return res;
}
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];
tot[i%2] += delt[i];
}
if(modval(tot[0]) == modval(tot[1])) cout<<"da"<<endl;
else cout<<"ne"<<endl;
while(q--){
int ind;
char c;
cin>>ind>>c;
ind--;
tot[ind%2] -= delt[ind];
a[ind] = c;
delt[ind] = a[ind] - b[ind];
tot[ind%2] += delt[ind];
if(modval(tot[0]) == modval(tot[1])) cout<<"da"<<endl;
else cout<<"ne"<<endl;
}
return 0;
}
Compilation message
Main.cpp: In function 'long long int modval(long long int)':
Main.cpp:9:8: warning: unused variable 'chl' [-Wunused-variable]
9 | int chl = 26;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
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 |
508 KB |
Output is correct |
11 |
Correct |
1 ms |
464 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 |
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 |
508 KB |
Output is correct |
11 |
Correct |
1 ms |
464 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 |
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 |
456 KB |
Output is correct |
28 |
Correct |
1 ms |
504 KB |
Output is correct |
29 |
Correct |
1 ms |
504 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 |
508 KB |
Output is correct |
11 |
Correct |
1 ms |
464 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 |
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 |
456 KB |
Output is correct |
28 |
Correct |
1 ms |
504 KB |
Output is correct |
29 |
Correct |
1 ms |
504 KB |
Output is correct |
30 |
Correct |
1 ms |
336 KB |
Output is correct |
31 |
Correct |
9 ms |
12160 KB |
Output is correct |
32 |
Correct |
11 ms |
12200 KB |
Output is correct |
33 |
Correct |
10 ms |
12180 KB |
Output is correct |
34 |
Correct |
10 ms |
12084 KB |
Output is correct |
35 |
Correct |
10 ms |
12184 KB |
Output is correct |
36 |
Correct |
11 ms |
12520 KB |
Output is correct |
37 |
Correct |
10 ms |
12520 KB |
Output is correct |
38 |
Correct |
10 ms |
12176 KB |
Output is correct |
39 |
Correct |
9 ms |
12660 KB |
Output is correct |
40 |
Correct |
9 ms |
12512 KB |
Output is correct |
41 |
Correct |
10 ms |
12184 KB |
Output is correct |
42 |
Correct |
10 ms |
12160 KB |
Output is correct |
43 |
Correct |
10 ms |
12696 KB |
Output is correct |
44 |
Correct |
9 ms |
12192 KB |
Output is correct |
45 |
Correct |
10 ms |
12308 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 |
508 KB |
Output is correct |
11 |
Correct |
1 ms |
464 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 |
143 ms |
1100 KB |
Output is correct |
17 |
Correct |
150 ms |
1096 KB |
Output is correct |
18 |
Correct |
154 ms |
968 KB |
Output is correct |
19 |
Correct |
146 ms |
1352 KB |
Output is correct |
20 |
Correct |
143 ms |
1096 KB |
Output is correct |
21 |
Correct |
147 ms |
1008 KB |
Output is correct |
22 |
Correct |
141 ms |
984 KB |
Output is correct |
23 |
Correct |
141 ms |
1096 KB |
Output is correct |
24 |
Correct |
144 ms |
1096 KB |
Output is correct |
25 |
Correct |
142 ms |
1008 KB |
Output is correct |
26 |
Correct |
141 ms |
1000 KB |
Output is correct |
27 |
Correct |
142 ms |
1000 KB |
Output is correct |
28 |
Correct |
155 ms |
1096 KB |
Output is correct |
29 |
Correct |
144 ms |
1120 KB |
Output is correct |
30 |
Correct |
144 ms |
1096 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 |
508 KB |
Output is correct |
11 |
Correct |
1 ms |
464 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 |
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 |
456 KB |
Output is correct |
28 |
Correct |
1 ms |
504 KB |
Output is correct |
29 |
Correct |
1 ms |
504 KB |
Output is correct |
30 |
Correct |
1 ms |
336 KB |
Output is correct |
31 |
Correct |
143 ms |
1100 KB |
Output is correct |
32 |
Correct |
150 ms |
1096 KB |
Output is correct |
33 |
Correct |
154 ms |
968 KB |
Output is correct |
34 |
Correct |
146 ms |
1352 KB |
Output is correct |
35 |
Correct |
143 ms |
1096 KB |
Output is correct |
36 |
Correct |
147 ms |
1008 KB |
Output is correct |
37 |
Correct |
141 ms |
984 KB |
Output is correct |
38 |
Correct |
141 ms |
1096 KB |
Output is correct |
39 |
Correct |
144 ms |
1096 KB |
Output is correct |
40 |
Correct |
142 ms |
1008 KB |
Output is correct |
41 |
Correct |
141 ms |
1000 KB |
Output is correct |
42 |
Correct |
142 ms |
1000 KB |
Output is correct |
43 |
Correct |
155 ms |
1096 KB |
Output is correct |
44 |
Correct |
144 ms |
1120 KB |
Output is correct |
45 |
Correct |
144 ms |
1096 KB |
Output is correct |
46 |
Correct |
165 ms |
1096 KB |
Output is correct |
47 |
Correct |
144 ms |
1248 KB |
Output is correct |
48 |
Correct |
150 ms |
1252 KB |
Output is correct |
49 |
Correct |
145 ms |
1256 KB |
Output is correct |
50 |
Correct |
170 ms |
1336 KB |
Output is correct |
51 |
Correct |
145 ms |
1268 KB |
Output is correct |
52 |
Correct |
145 ms |
1256 KB |
Output is correct |
53 |
Correct |
145 ms |
1104 KB |
Output is correct |
54 |
Correct |
154 ms |
1096 KB |
Output is correct |
55 |
Correct |
143 ms |
1156 KB |
Output is correct |
56 |
Correct |
146 ms |
1272 KB |
Output is correct |
57 |
Correct |
144 ms |
1248 KB |
Output is correct |
58 |
Correct |
145 ms |
1268 KB |
Output is correct |
59 |
Correct |
175 ms |
1248 KB |
Output is correct |
60 |
Correct |
148 ms |
1352 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 |
508 KB |
Output is correct |
11 |
Correct |
1 ms |
464 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 |
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 |
456 KB |
Output is correct |
28 |
Correct |
1 ms |
504 KB |
Output is correct |
29 |
Correct |
1 ms |
504 KB |
Output is correct |
30 |
Correct |
1 ms |
336 KB |
Output is correct |
31 |
Correct |
9 ms |
12160 KB |
Output is correct |
32 |
Correct |
11 ms |
12200 KB |
Output is correct |
33 |
Correct |
10 ms |
12180 KB |
Output is correct |
34 |
Correct |
10 ms |
12084 KB |
Output is correct |
35 |
Correct |
10 ms |
12184 KB |
Output is correct |
36 |
Correct |
11 ms |
12520 KB |
Output is correct |
37 |
Correct |
10 ms |
12520 KB |
Output is correct |
38 |
Correct |
10 ms |
12176 KB |
Output is correct |
39 |
Correct |
9 ms |
12660 KB |
Output is correct |
40 |
Correct |
9 ms |
12512 KB |
Output is correct |
41 |
Correct |
10 ms |
12184 KB |
Output is correct |
42 |
Correct |
10 ms |
12160 KB |
Output is correct |
43 |
Correct |
10 ms |
12696 KB |
Output is correct |
44 |
Correct |
9 ms |
12192 KB |
Output is correct |
45 |
Correct |
10 ms |
12308 KB |
Output is correct |
46 |
Correct |
143 ms |
1100 KB |
Output is correct |
47 |
Correct |
150 ms |
1096 KB |
Output is correct |
48 |
Correct |
154 ms |
968 KB |
Output is correct |
49 |
Correct |
146 ms |
1352 KB |
Output is correct |
50 |
Correct |
143 ms |
1096 KB |
Output is correct |
51 |
Correct |
147 ms |
1008 KB |
Output is correct |
52 |
Correct |
141 ms |
984 KB |
Output is correct |
53 |
Correct |
141 ms |
1096 KB |
Output is correct |
54 |
Correct |
144 ms |
1096 KB |
Output is correct |
55 |
Correct |
142 ms |
1008 KB |
Output is correct |
56 |
Correct |
141 ms |
1000 KB |
Output is correct |
57 |
Correct |
142 ms |
1000 KB |
Output is correct |
58 |
Correct |
155 ms |
1096 KB |
Output is correct |
59 |
Correct |
144 ms |
1120 KB |
Output is correct |
60 |
Correct |
144 ms |
1096 KB |
Output is correct |
61 |
Correct |
165 ms |
1096 KB |
Output is correct |
62 |
Correct |
144 ms |
1248 KB |
Output is correct |
63 |
Correct |
150 ms |
1252 KB |
Output is correct |
64 |
Correct |
145 ms |
1256 KB |
Output is correct |
65 |
Correct |
170 ms |
1336 KB |
Output is correct |
66 |
Correct |
145 ms |
1268 KB |
Output is correct |
67 |
Correct |
145 ms |
1256 KB |
Output is correct |
68 |
Correct |
145 ms |
1104 KB |
Output is correct |
69 |
Correct |
154 ms |
1096 KB |
Output is correct |
70 |
Correct |
143 ms |
1156 KB |
Output is correct |
71 |
Correct |
146 ms |
1272 KB |
Output is correct |
72 |
Correct |
144 ms |
1248 KB |
Output is correct |
73 |
Correct |
145 ms |
1268 KB |
Output is correct |
74 |
Correct |
175 ms |
1248 KB |
Output is correct |
75 |
Correct |
148 ms |
1352 KB |
Output is correct |
76 |
Execution timed out |
1058 ms |
19768 KB |
Time limit exceeded |
77 |
Halted |
0 ms |
0 KB |
- |