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;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define int long long
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
const int INF=1e18;
const int C=26;
int32_t main() {
LCBorz;
int n,q;cin>>n>>q;
string s,t;cin>>s>>t;
int a=0,b=0;
for(int i=0;i<n;i++){
if(i&1)a=(a+s[i]-'a')%C;
else a=(a-s[i]+'a'+C)%C;
}
for(int i=0;i<n;i++){
if(i&1)b=(b+t[i]-'a')%C;
else b=(b-t[i]+'a'+C)%C;
}
cout<<(a==b?"da":"ne")<<endl;
for(int i=0;i<q;i++){
int p;char c;cin>>p>>c;
p--;
if(p&1)a=(a+c-s[p]+C)%C;
else a=(a-c+s[p]+C)%C;
s[p]=c;
cout<<(a==b?"da":"ne")<<endl;
}
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... |