This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
using str = string;
template<class T> using V = vector<T>;
using vi = V<int>;
int main() {
cin.tie(0)->sync_with_stdio(0);
int N, Q; cin >> N >> Q;
str S; cin >> S;
str T; cin >> T;
int pos = 0, neg = 0;
vi D(N); for(int i = 0; i < N; i++) {
D[i] = S[i] - T[i];
if (D[i] < 0) D[i] += 26;
if (i % 2 == 0) pos += D[i];
else neg += D[i];
}
cout << (pos % 26 == neg % 26 ? "da" : "ne") << nl;
for(int q = 0; q < Q; q++) {
int i; char x; cin >> i >> x; --i;
S[i] = x;
if (i % 2 == 0) pos -= D[i];
else neg -= D[i];
D[i] = S[i] - T[i];
if (D[i] < 0) D[i] += 26;
if (i % 2 == 0) pos += D[i];
else neg += D[i];
cout << (pos % 26 == neg % 26 ? "da" : "ne") << nl;
}
exit(0-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... |