#include<bits/stdc++.h>
#define ll long long
#define ldb long double
#define db double
#define fi first
#define se second
#define sza(a) (int)a.size()
#define pir pair<int,int>
#define pirll pair<ll,ll>
using namespace std;
const int maxn = 1e6 + 5;
const int N = 26;
template <class t1,class t2> inline void maxi(t1 &x,t2 y){if (x < y) x = y;}
template <class t1,class t2> inline void mini(t1 &x,t2 y){if (x > y) x = y;}
inline void print_(bool x){
if (x) cout << "da" << "\n";
if (!x) cout << "ne" << "\n";
}
int a[maxn],b[maxn];
void input(int n,int q,int &ca,int &cb){
ca = cb = 0;
string A,B;
cin >> A >> B;
for (int i = 1 ; i <= n ; i++){
a[i] = A[i - 1] - 97;
b[i] = B[i - 1] - 97;
ca = (ca + ((i % 2) ? a[i] : -a[i]) + N*N) % N;
cb = (cb + ((i % 2) ? b[i] : -b[i]) + N*N) % N;
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int n,q,ca,cb;
cin >> n >> q;
input(n,q,ca,cb);
print_(ca == cb);
while (q--){
int p;char ch;
cin >> p >> ch;
int c = ch - 97;
ca = (ca + ((p % 2) ? (-a[p]) : a[p]) + N*N) % N;
ca = (ca + ((p % 2) ? c : (-c)) + N*N) % N;
a[p] = c;
print_(ca == cb);
}
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... |