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"
#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
void _(){
int n,q;
cin >> n >> q;
string s,t;
cin >> s >> t;
array<int,2> pre = {0,0};
for(int i = 0 ; i < n; i++){
pre[i&1] += (t[i] - s[i] + 26) % 26;
}
if((n-1)&1){
if((pre[1]-pre[0])%26==0) cout << "da\n";
else cout << "ne\n";
}
else{
if((pre[0]-pre[1])%26==0) cout << "da\n";
else cout << "ne\n";
}
while(q--){
int ind;
char a;
cin >> ind >> a;
ind--;
pre[ind&1]-=(t[ind]-s[ind]+26)%26;
s[ind] = a;
pre[ind&1]+=(t[ind]-s[ind]+26)%26;
if((n-1)&1){
if((pre[1]-pre[0])%26==0) cout << "da\n";
else cout << "ne\n";
}
else{
if((pre[0]-pre[1])%26==0) cout << "da\n";
else cout << "ne\n";
}
}
}
int32_t main(){
cin.tie(0); ios::sync_with_stdio(0);
int tc=1;//cin >> tc;
while(tc--) _();
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... |