This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY LLONG_MAX
#define mod 998244353
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define lim 1000005
#define fi first
#define se second
int dizi[lim];
int pre[lim]; // gereksiz
int32_t main(){
faster
int n,q;cin>>n>>q;
string a,b;cin>>a>>b;
int bir=0,iki=0;
FOR{
dizi[i]=b[i-1]-a[i-1];
if(i&1)bir+=dizi[i];
else iki+=dizi[i];
bir+=26;
iki+=26;
bir%=26;
iki%=26;
}
if(bir==iki){
cout<<"da"<<'\n';
}
else cout<<"ne"<<'\n';
while(q--){
int pos;char c;
cin>>pos>>c;
a[pos-1]=c;
if(pos&1){
bir-=dizi[pos];
bir=(bir+26)%26;
dizi[pos]=b[pos-1]-a[pos-1];
bir+=dizi[pos]+26;
bir=bir%26;
}
else{
iki-=dizi[pos];
iki=(iki+26)%26;
dizi[pos]=b[pos-1]-a[pos-1];
iki+=dizi[pos]+26;
iki=(iki%26);
}
if(bir==iki){
cout<<"da"<<'\n';
}
else cout<<"ne"<<'\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... |