Submission #1114261

#TimeUsernameProblemLanguageResultExecution timeMemory
1114261epicci23Bliskost (COI23_bliskost)C++17
100 / 100
134 ms16620 KiB
#include "bits/stdc++.h" #define int long long #define all(v) v.begin() , v.end() #define sz(a) (int)a.size() using namespace std; void _(){ int n,q; cin >> n >> q; string s,t; cin >> s >> t; array<int,2> pre = {0,0}; for(int i = 0 ; i < n; i++){ pre[i&1] += (t[i] - s[i] + 26) % 26; } if((n-1)&1){ if((pre[1]-pre[0])%26==0) cout << "da\n"; else cout << "ne\n"; } else{ if((pre[0]-pre[1])%26==0) cout << "da\n"; else cout << "ne\n"; } while(q--){ int ind; char a; cin >> ind >> a; ind--; pre[ind&1]-=(t[ind]-s[ind]+26)%26; s[ind] = a; pre[ind&1]+=(t[ind]-s[ind]+26)%26; if((n-1)&1){ if((pre[1]-pre[0])%26==0) cout << "da\n"; else cout << "ne\n"; } else{ if((pre[0]-pre[1])%26==0) cout << "da\n"; else cout << "ne\n"; } } } int32_t main(){ cin.tie(0); ios::sync_with_stdio(0); int tc=1;//cin >> tc; while(tc--) _(); 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...