Submission #956060

#TimeUsernameProblemLanguageResultExecution timeMemory
956060Darren0724Bliskost (COI23_bliskost)C++17
100 / 100
158 ms16832 KiB
#include <bits/stdc++.h> using namespace std; #define LCBorz ios_base::sync_with_stdio(false); cin.tie(0); #define int long long #define all(x) x.begin(), x.end() #define endl '\n' const int N=200005; const int INF=1e18; const int C=26; int32_t main() { LCBorz; int n,q;cin>>n>>q; string s,t;cin>>s>>t; int a=0,b=0; for(int i=0;i<n;i++){ if(i&1)a=(a+s[i]-'a')%C; else a=(a-s[i]+'a'+C)%C; } for(int i=0;i<n;i++){ if(i&1)b=(b+t[i]-'a')%C; else b=(b-t[i]+'a'+C)%C; } cout<<(a==b?"da":"ne")<<endl; for(int i=0;i<q;i++){ int p;char c;cin>>p>>c; p--; if(p&1)a=(a+c-s[p]+C)%C; else a=(a-c+s[p]+C)%C; s[p]=c; cout<<(a==b?"da":"ne")<<endl; } return 0; }
#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...