#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define fr first
#define sc second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(),x.end()
#define sp << " " <<
#define inf 1e18
#define N 1000000
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tuple<int,int,int> tiii;
typedef pair<int,int> pii;
const int mod=26;
int f(int x,int y){
return (x-y+mod)%mod;
}
void cev(char s,char t,int e,int o,int n){
if(n&1){
if(f(t,s)==f(o,e))
cout << "da" << endl;
else
cout << "ne" << endl;
}
else{
if(f(t,s)==f(e,o))
cout << "da" << endl;
else
cout << "ne" << endl;
}
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
int n,q;
string s,t;
cin >> n >> q;
cin >> s >> t;
int o=0,e=0;
for(int i=0;i<n-1;i++){
if(i&1) o+=f(t[i],s[i]);
else e+=f(t[i],s[i]);
}
e%=mod;o%=mod;
cev(s[n-1],t[n-1],e,o,n);
while(q--){
int x;
char c;
cin >> x >> c;
if(x!=n){
if(x&1)
e=(e+f(s[x-1],c))%mod;
else
o=(o+f(s[x-1],c))%mod;
}
s[x-1]=c;
cev(s[n-1],t[n-1],e,o,n);
}
}
# | 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... |