/* Author : Mychecksdead */
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
const int N = 1e6+100, M = 1e5+10, K = 52, MX = 30;
int n, q;
string s, t;
int sum1 = 0, sum2 = 0;
void ans(){
sum1%=26;
sum1+=26;
sum1%=26;
sum2%=26;
sum2+=26;
sum2%=26;
if(sum1==sum2) cout << "da\n";
else cout << "ne\n";
}
void solve(){
cin >> n >> q >> s >> t;
int e = 1;
for(char c: s) {sum1 += (c-'a')*e; e*=-1;}
e=1;
for(char c: t) {sum2 += (c-'a')*e; e*=-1;}
ans();
for(int i = 1; i <= q; ++i){
int p; char c; cin >> p >> c;
--p;
sum1 -= (s[p]-'a')*(p%2==0?1:-1);
s[p] = c;
sum1 += (s[p]-'a')*(p%2==0?1:-1);
ans();
}
}
int main(){
cin.tie(0); ios::sync_with_stdio(0);
int tt = 1, aa;
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
while(tt--){
solve();
}
cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" seconds\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... |