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;
void solve(){
int n, q;cin >> n >> q;
string s, t;cin >> s >> t;
int aemo = 0, bemo = 0;
int a[n],b[n];for(int i = 0;i < n;i++){
a[i]=s[i]-'a';
b[i]=t[i]-'a';
if(i&1) aemo += 26-a[i];
else aemo += a[i];
if(i&1) bemo += 26-b[i];
else bemo += b[i];
}
if(aemo%26 == bemo%26) cout << "da\n";
else cout << "ne\n";
while(q--){
int p;char c;cin >> p >> c;
p--;c -= 'a';
if(p&1){
aemo -= 26-a[p];
aemo += 26-c;
} else {
aemo -= a[p];
aemo += c;
}
a[p]=c;
if(aemo%26 == bemo%26) cout << "da\n";
else cout << "ne\n";
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
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... |