Submission #1060947

#TimeUsernameProblemLanguageResultExecution timeMemory
1060947NeroZeinBliskost (COI23_bliskost)C++17
28 / 100
22 ms3472 KiB
#include "bits/stdc++.h" using namespace std; #ifdef Nero #include "Deb.h" #else #define debug(...) #endif void add(int& x, int y) { x += y; if (x >= 26) x -= 26; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, q; cin >> n >> q; vector<int> s(2); string t; cin >> t; for (int i = 0; i < n; ++i) { add(s[i % 2], t[i] - 'a'); } for (int i = 0; i < n; ++i) { char c; cin >> c; add(s[i % 2], 26 - (c - 'a')); } cout << (s[0] == s[1] ? "da" : "ne") << '\n'; while (q--) { int p; char c; cin >> p >> c; add(s[p ^ 1], 26 - (t[p - 1] - 'a')); t[p - 1] = c; add(s[p ^ 1], t[p - 1] - 'a'); cout << (s[0] % 26 == s[1] % 26 ? "da" : "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...