Submission #1212069

#TimeUsernameProblemLanguageResultExecution timeMemory
1212069shrek_loverBliskost (COI23_bliskost)C++20
100 / 100
154 ms9832 KiB
#include <bits/stdc++.h> using namespace std; const int mxn = 1e6 + 10; string str, target; int n, q, shrek[mxn]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> q; cin >> str >> target; int O = 0, E = 0, SUS = 0; for(int i = 0; i < n; i++) { int a = str[i] - 'a'; int t = target[i] - 'a'; shrek[i] = a; if(i & 1) { O = (O + a) % 26; SUS = (SUS - t + 26) % 26; } else { E = (E + a) % 26; SUS = (SUS + t) % 26; } } // cout << E << " - " << O << " = " << SUS << endl; if(E == (O + SUS) % 26) cout << "da\n"; else cout << "ne\n"; while(q--) { int i; char x; cin >> i >> x; x -= 'a'; i--; if(i & 1) { O = (O - shrek[i] + 26) % 26; O = (O + x) % 26; } else { E = (E - shrek[i] + 26) % 26; E = (E + x) % 26; } shrek[i] = x; if(E == (O + SUS) % 26) cout << "da\n"; else cout << "ne\n"; } 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...