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>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define int long long int
//#define endl '\n'
#define N 150100
#define M 15
#define big 2147483647
#define bigg 9223372036854775807
#define pb push_back
#define p push
#define ins insert
#define f first
char sayi(char a,int x){
if(x>=0){
while(x--){
if(a=='z')a='a';
else a++;
}
return a;
}
while(x++){
if(a=='a')a='z';
else a--;
}
return a;
}
signed main(){
lalala;
int n,q;cin>>n>>q;
string str,hedef;cin>>str>>hedef;
string yedek=str;
for(int i=0;i<(int)yedek.size()-1;i++){
while(yedek[i]!=hedef[i]){
if(yedek[i]=='z')yedek[i]='a';
else yedek[i]++;
if(yedek[i+1]=='z')yedek[i+1]='a';
else yedek[i+1]++;
}
}
//str[n-1]=yedek[n-1];
if(yedek[n-1]!=hedef[n-1])cout<<"ne"<<endl;
else cout<<"da"<<endl;
//cout<<str[n-1]<<endl;
while(q--){
int x;char a;cin>>x>>a;
x--;
str[x]=a;
yedek=str;
for(int i=0;i<(int)yedek.size()-1;i++){
while(yedek[i]!=hedef[i]){
if(yedek[i]=='z')yedek[i]='a';
else yedek[i]++;
if(yedek[i+1]=='z')yedek[i+1]='a';
else yedek[i+1]++;
}
}
if(yedek[n-1]!=hedef[n-1])cout<<"ne"<<endl;
else cout<<"da"<<endl;
}
}
# | 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... |