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;
int n,q,av,dov;
string s,ss;
void khor(){
if(av==dov){
cout<<"da\n";
}else{
cout<<"ne\n";
}
}
void vorod(){
cin>>n>>q;
cin>>s>>ss;
}
void pre(){
for(int i=0;i<n;i++){
if(i&1){
dov+=(ss[i]-s[i]+26)%26;
dov+=26;
dov%=26;
}else{
av+=(ss[i]-s[i]+26)%26;
av+=26;
av%=26;
}
}
}
void solve(){
khor();
for(int i=0;i<q;i++){
int a;
char c;
cin>>a>>c;
a--;
if(a&1){
dov-=(ss[a]-s[a]+26)%26;
dov+=26;
dov%=26;
s[a]=c;
dov+=(ss[a]-s[a]+26)%26;
dov+=26;
dov%=26;
}else{
av-=(ss[a]-s[a]+26)%26;
av+=26;
av%=26;
s[a]=c;
av+=(ss[a]-s[a]+26)%26;
av+=26;
av%=26;
}
khor();
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
vorod();
pre();
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... |