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;
typedef long long ll;
int main() {
int n,q; cin>>n>>q;
string a,b; cin>>a>>b;
ll sa=0, sb=0;
for (int i=1; i<=n; i++) {
sa+=(a[i-1]-'a'+1)*(n%2==i%2?1:-1);
sb+=(b[i-1]-'a'+1)*(n%2==i%2?1:-1);
}
if ((sa-sb)%26==0) cout<<"da\n";
else cout<<"ne\n";
while (q--) {
int p; char c; cin>>p>>c;
int v=(c-'a'+1)*(n%2==p%2?1:-1);
sa-=(a[p-1]-'a'+1)*(n%2==p%2?1:-1);
a[p-1]=c;
sa+=v;
if ((sa-sb)%26==0) 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... |