#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 42
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
string a, b;
cin >> a >> b;
int ax = 0, ay = 0;
int bx = 0, by = 0;
for (int i = 0; i < n; i++) {
if (i & 1) {
ax += a[i];
bx += b[i];
}
else {
ay += a[i];
by += b[i];
}
}
if ((ax - bx) % 26 == (ay - by) % 26) {
cout << "da\n";
}
else {
cout << "ne\n";
}
while (q--) {
int i;
char c;
cin >> i >> c;
i--;
if (i & 1) {
ax = ax - a[i] + c;
}
else {
ay = ay - a[i] + c;
}
a[i] = c;
if ((ax - bx) % 26 == (ay - by) % 26) {
cout << "da\n";
}
else {
cout << "ne\n";
}
}
return 0;
}
# | 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... |