Submission #998444

#TimeUsernameProblemLanguageResultExecution timeMemory
998444amirhoseinfar1385Bliskost (COI23_bliskost)C++17
100 / 100
150 ms16476 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[a]-s[a]+26)%26; dov+=26; dov%=26; s[a]=c; dov+=(ss[a]-s[a]+26)%26; dov+=26; dov%=26; }else{ av-=(ss[a]-s[a]+26)%26; av+=26; av%=26; s[a]=c; av+=(ss[a]-s[a]+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...