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;
//#include<bits/extc++.h>
//__gnu_pbds
string ans[2]={"ne","da"};
int main(){
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n,q;cin>>n>>q;
string s;cin>>s;
string b;cin>>b;
int cnt1=0;
int cnt2=0;
for(auto i : s) cnt1+=i-'a';
cnt1%=2;
for(auto i : b) cnt2+=i-'a';
cnt2%=2;
cout<<ans[cnt1==cnt2]<<"\n";
for(int i=0;i<q;i++){
int p;cin>>p;
p--;
char x;cin>>x;
cnt1-=s[p]-'a';
cnt1+=x-'a';
s[p]=x;
cnt1%=2;
if(cnt1<0) cnt1+=2;
cout<<ans[cnt1==cnt2]<<"\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... |