#define ONLINE_JUDGE
#include <bits/stdc++.h>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using oset = tree<T,null_type,less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using ll = long long;
using ld = long double;
#define no cout<<"NO"<<endl
#define yes cout<<"YES"<<endl
#define da cout<<"da"<<endl
#define ne cout<<"ne"<<endl
#define send ios::sync_with_stdio(false);
#define help cin.tie(0);
void solve(int T);
const int N = 3e5 + 10;
const int M = 405;
const int SQRT = sqrt(N);
const int LOG = 20;
const int INF = 1e12;
const int MOD = 45678;
const ld EPS = 1e-9;
int ans;
int n, m, q, l, r, x, y, mx, mn;
int32_t main(){
#ifndef ONLINE_JUDGE
auto begin = chrono::high_resolution_clock::now();
#endif
cout<<setprecision(4)<<fixed;
send help;
int tt = 1;
//cin>>tt; //? Comment if no testcases
for(int i = 1;i<=tt;i++){
#ifndef ONLINE_JUDGE
cout<<"Case "<<i<<": "<<endl;
#endif
solve(i);
}
#ifndef ONLINE_JUDGE
auto end = chrono::high_resolution_clock::now();
cout<<"Time: "<<chrono::duration_cast<chrono::duration<double>>(end - begin).count()<<endl;
#endif
return 0;
}
string s, t;
inline int calc(int i){
if(i & 1)return s[i] - t[i];
else return t[i] - s[i];
}
void solve(int T){
cin>>n>>q>>s>>t;
int sum = 0;
for(int i = 0;i<n;i++)sum += calc(i);
if(sum % 26 == 0)da;
else ne;
while(q--){
int p;
char v;
cin>>p>>v;
--p;
sum -= calc(p);
s[p] = v;
sum += calc(p);
if(sum % 26 == 0)da;
else ne;
}
}
//Te molam da raboti !!
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
344 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
344 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
5 ms |
4396 KB |
Output is correct |
32 |
Correct |
5 ms |
4596 KB |
Output is correct |
33 |
Correct |
4 ms |
4508 KB |
Output is correct |
34 |
Correct |
5 ms |
4508 KB |
Output is correct |
35 |
Correct |
4 ms |
4600 KB |
Output is correct |
36 |
Correct |
4 ms |
4852 KB |
Output is correct |
37 |
Correct |
4 ms |
4852 KB |
Output is correct |
38 |
Correct |
4 ms |
4508 KB |
Output is correct |
39 |
Correct |
4 ms |
4852 KB |
Output is correct |
40 |
Correct |
4 ms |
4844 KB |
Output is correct |
41 |
Correct |
5 ms |
4796 KB |
Output is correct |
42 |
Correct |
4 ms |
4600 KB |
Output is correct |
43 |
Correct |
4 ms |
4852 KB |
Output is correct |
44 |
Correct |
4 ms |
4524 KB |
Output is correct |
45 |
Correct |
5 ms |
4524 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
114 ms |
944 KB |
Output is correct |
17 |
Correct |
127 ms |
1104 KB |
Output is correct |
18 |
Correct |
114 ms |
1048 KB |
Output is correct |
19 |
Correct |
119 ms |
1108 KB |
Output is correct |
20 |
Correct |
117 ms |
1108 KB |
Output is correct |
21 |
Correct |
113 ms |
1076 KB |
Output is correct |
22 |
Correct |
112 ms |
1104 KB |
Output is correct |
23 |
Correct |
114 ms |
1028 KB |
Output is correct |
24 |
Correct |
115 ms |
1104 KB |
Output is correct |
25 |
Correct |
114 ms |
1008 KB |
Output is correct |
26 |
Correct |
116 ms |
1036 KB |
Output is correct |
27 |
Correct |
135 ms |
1012 KB |
Output is correct |
28 |
Correct |
114 ms |
916 KB |
Output is correct |
29 |
Correct |
113 ms |
976 KB |
Output is correct |
30 |
Correct |
117 ms |
980 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
344 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
114 ms |
944 KB |
Output is correct |
32 |
Correct |
127 ms |
1104 KB |
Output is correct |
33 |
Correct |
114 ms |
1048 KB |
Output is correct |
34 |
Correct |
119 ms |
1108 KB |
Output is correct |
35 |
Correct |
117 ms |
1108 KB |
Output is correct |
36 |
Correct |
113 ms |
1076 KB |
Output is correct |
37 |
Correct |
112 ms |
1104 KB |
Output is correct |
38 |
Correct |
114 ms |
1028 KB |
Output is correct |
39 |
Correct |
115 ms |
1104 KB |
Output is correct |
40 |
Correct |
114 ms |
1008 KB |
Output is correct |
41 |
Correct |
116 ms |
1036 KB |
Output is correct |
42 |
Correct |
135 ms |
1012 KB |
Output is correct |
43 |
Correct |
114 ms |
916 KB |
Output is correct |
44 |
Correct |
113 ms |
976 KB |
Output is correct |
45 |
Correct |
117 ms |
980 KB |
Output is correct |
46 |
Correct |
120 ms |
1212 KB |
Output is correct |
47 |
Correct |
114 ms |
1104 KB |
Output is correct |
48 |
Correct |
113 ms |
1224 KB |
Output is correct |
49 |
Correct |
114 ms |
1108 KB |
Output is correct |
50 |
Correct |
116 ms |
1112 KB |
Output is correct |
51 |
Correct |
126 ms |
1108 KB |
Output is correct |
52 |
Correct |
117 ms |
1228 KB |
Output is correct |
53 |
Correct |
115 ms |
1360 KB |
Output is correct |
54 |
Correct |
115 ms |
1104 KB |
Output is correct |
55 |
Correct |
115 ms |
1108 KB |
Output is correct |
56 |
Correct |
116 ms |
1108 KB |
Output is correct |
57 |
Correct |
117 ms |
1084 KB |
Output is correct |
58 |
Correct |
115 ms |
1308 KB |
Output is correct |
59 |
Correct |
116 ms |
1224 KB |
Output is correct |
60 |
Correct |
114 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
344 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
5 ms |
4396 KB |
Output is correct |
32 |
Correct |
5 ms |
4596 KB |
Output is correct |
33 |
Correct |
4 ms |
4508 KB |
Output is correct |
34 |
Correct |
5 ms |
4508 KB |
Output is correct |
35 |
Correct |
4 ms |
4600 KB |
Output is correct |
36 |
Correct |
4 ms |
4852 KB |
Output is correct |
37 |
Correct |
4 ms |
4852 KB |
Output is correct |
38 |
Correct |
4 ms |
4508 KB |
Output is correct |
39 |
Correct |
4 ms |
4852 KB |
Output is correct |
40 |
Correct |
4 ms |
4844 KB |
Output is correct |
41 |
Correct |
5 ms |
4796 KB |
Output is correct |
42 |
Correct |
4 ms |
4600 KB |
Output is correct |
43 |
Correct |
4 ms |
4852 KB |
Output is correct |
44 |
Correct |
4 ms |
4524 KB |
Output is correct |
45 |
Correct |
5 ms |
4524 KB |
Output is correct |
46 |
Correct |
114 ms |
944 KB |
Output is correct |
47 |
Correct |
127 ms |
1104 KB |
Output is correct |
48 |
Correct |
114 ms |
1048 KB |
Output is correct |
49 |
Correct |
119 ms |
1108 KB |
Output is correct |
50 |
Correct |
117 ms |
1108 KB |
Output is correct |
51 |
Correct |
113 ms |
1076 KB |
Output is correct |
52 |
Correct |
112 ms |
1104 KB |
Output is correct |
53 |
Correct |
114 ms |
1028 KB |
Output is correct |
54 |
Correct |
115 ms |
1104 KB |
Output is correct |
55 |
Correct |
114 ms |
1008 KB |
Output is correct |
56 |
Correct |
116 ms |
1036 KB |
Output is correct |
57 |
Correct |
135 ms |
1012 KB |
Output is correct |
58 |
Correct |
114 ms |
916 KB |
Output is correct |
59 |
Correct |
113 ms |
976 KB |
Output is correct |
60 |
Correct |
117 ms |
980 KB |
Output is correct |
61 |
Correct |
120 ms |
1212 KB |
Output is correct |
62 |
Correct |
114 ms |
1104 KB |
Output is correct |
63 |
Correct |
113 ms |
1224 KB |
Output is correct |
64 |
Correct |
114 ms |
1108 KB |
Output is correct |
65 |
Correct |
116 ms |
1112 KB |
Output is correct |
66 |
Correct |
126 ms |
1108 KB |
Output is correct |
67 |
Correct |
117 ms |
1228 KB |
Output is correct |
68 |
Correct |
115 ms |
1360 KB |
Output is correct |
69 |
Correct |
115 ms |
1104 KB |
Output is correct |
70 |
Correct |
115 ms |
1108 KB |
Output is correct |
71 |
Correct |
116 ms |
1108 KB |
Output is correct |
72 |
Correct |
117 ms |
1084 KB |
Output is correct |
73 |
Correct |
115 ms |
1308 KB |
Output is correct |
74 |
Correct |
116 ms |
1224 KB |
Output is correct |
75 |
Correct |
114 ms |
1108 KB |
Output is correct |
76 |
Execution timed out |
1043 ms |
14964 KB |
Time limit exceeded |
77 |
Halted |
0 ms |
0 KB |
- |