This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// HELLNAH 2
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ins insert
#define pb push_back
#define endl '\n'
#define putr(x) cout<<x<<endl;return;
#define all(x) x.begin(),x.end()
const int mod = 1e9 +7, sze = 1e5 +5, inf = INT_MAX, LL = 30;
void rush(){
int n,q;
cin>>n>>q;
string s,t;
cin>>s>>t;
int sum=0;
for(int i=0;i<n;i++){
sum=(-sum + t[i]-s[i] + 26)%26;
}
cout<<(sum? "ne":"da")<<endl;
while(q--){
int idx;
cin>>idx;
char c;
cin>>c;
int diff = c - s[--idx];
s[idx]=c;
sum= (sum+26 + diff + ( (n-idx)&1) * -2 * diff )%26;
/* ala bu tek cut sohbet i seye gore imis
tek olanda : -d +d -d +d -d
^ last
cut olanda : -d +d -d +d
^ last
*/
cout<<(sum? "ne":"da")<<endl;
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int tt = 1;
// cin>>tt;
while(tt--){
rush();
}
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... |