#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n, q;
cin >> n >> q;
string a, b;
cin >> a >> b;
int sum = 0;
for (int i = 0; i < n; i++) {
int d = b[i] - a[i];
if ((i + 1) % 2 == n % 2) {
sum += d;
} else {
sum -= d;
}
}
if (sum % 26 == 0) {
cout << "da\n";
} else {
cout << "ne\n";
}
for (int i = 0; i < q; i++) {
char c;
int idx;
cin >> idx >> c;
int d = b[idx] - a[idx];
if ((i + 1) % 2 == n % 2) {
sum -= d;
} else {
sum += d;
}
a[idx] = c;
d = b[idx] - a[idx];
if ((i + 1) % 2 == n % 2) {
sum += d;
} else {
sum -= d;
}
if (sum % 26== 0) {
cout << "da\n";
} else {
cout << "ne\n";
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
//cin >> t;
while (t--) {
solve();
}
}
# | 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... |