Submission #998441

#TimeUsernameProblemLanguageResultExecution timeMemory
998441amirhoseinfar1385Bliskost (COI23_bliskost)C++17
28 / 100
10 ms4852 KiB
#include<bits/stdc++.h> using namespace std; int n,q,av,dov; string s,ss; void khor(){ if(av==dov){ cout<<"da\n"; }else{ cout<<"ne\n"; } } void vorod(){ cin>>n>>q; cin>>s>>ss; } void pre(){ for(int i=0;i<n;i++){ if(i&1){ dov+=(ss[i]-s[i]+26)%26; dov+=26; dov%=26; }else{ av+=(ss[i]-s[i]+26)%26; av+=26; av%=26; } } } void solve(){ khor(); for(int i=0;i<q;i++){ int a; char c; cin>>a>>c; a--; if(a&1){ dov-=(ss[i]-s[i]+26)%26; dov+=26; dov%=26; s[i]=c; dov+=(ss[i]-s[i]+26)%26; dov+=26; dov%=26; }else{ av-=(ss[i]-s[i]+26)%26; av+=26; av%=26; s[i]=c; av+=(ss[i]-s[i]+26)%26; av+=26; av%=26; } khor(); } } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); vorod(); pre(); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...