This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define debug(...)
#endif
void add(int& x, int y) {
x += y;
if (x >= 26) x -= 26;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
vector<int> s(2);
string t;
cin >> t;
for (int i = 0; i < n; ++i) {
add(s[i % 2], t[i] - 'a');
}
for (int i = 0; i < n; ++i) {
char c;
cin >> c;
add(s[i % 2], 26 - (c - 'a'));
}
cout << (s[0] == s[1] ? "da" : "ne") << '\n';
while (q--) {
int p;
char c;
cin >> p >> c;
add(s[(p % 2) ^ 1], 26 - (t[p - 1] - 'a'));
t[p - 1] = c;
add(s[(p % 2) ^ 1], t[p - 1] - 'a');
cout << (s[0] == s[1] ? "da" : "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... |