#include "bits/stdc++.h"
using namespace std;
#define SPEED ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define fi first
#define se second
#define endl "\n"
#define ALL(x) x.begin(), x.end()
#define sz(x) x.size()
#define intt long long
// #define intt int
const intt mod = 1e9 + 7;
const intt mxN = 4e5 + 5;
const intt inf = 1e18 + 10;
intt dis(char a, char b) {
intt A = a - 96;
intt B = b - 96;
if(A <= B) return B - A;
return 26 - A + B;
}
void solve() {
intt N, Q;
string a, b;
cin >> N >> Q >> a >> b;
intt e = 0, o = 0;
for(intt i = 0; i < N; i++) {
intt l = dis(a[i], b[i]);
if(i % 2 == 0) e += l;
else o += l;
}
if(e % 26 == o % 26) {
cout << "da" << endl;
} else {
cout << "ne" << endl;
}
while(Q--) {
intt p;
char c;
cin >> p >> c;
--p;
if(p % 2 == 0) e -= dis(a[p], b[p]);
else o -= dis(a[p], b[p]);
a[p] = c;
if(p % 2 == 0) e += dis(a[p], b[p]);
else o += dis(a[p], b[p]);
if(e % 26 == o % 26) {
cout << "da" << endl;
} else {
cout << "ne" << endl;
}
}
}
signed main() {
SPEED;
intt tst = 1;
// cin >> tst;
while (tst--) {
solve();
}
}
/*
p00000
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |