Submission #912706

#TimeUsernameProblemLanguageResultExecution timeMemory
912706NK_Bliskost (COI23_bliskost)C++17
100 / 100
196 ms20452 KiB
// Success consists of going from failure to failure without loss of enthusiasm #include <bits/stdc++.h> using namespace std; #define nl '\n' using str = string; template<class T> using V = vector<T>; using vi = V<int>; int main() { cin.tie(0)->sync_with_stdio(0); int N, Q; cin >> N >> Q; str S; cin >> S; str T; cin >> T; int pos = 0, neg = 0; vi D(N); for(int i = 0; i < N; i++) { D[i] = S[i] - T[i]; if (D[i] < 0) D[i] += 26; if (i % 2 == 0) pos += D[i]; else neg += D[i]; } cout << (pos % 26 == neg % 26 ? "da" : "ne") << nl; for(int q = 0; q < Q; q++) { int i; char x; cin >> i >> x; --i; S[i] = x; if (i % 2 == 0) pos -= D[i]; else neg -= D[i]; D[i] = S[i] - T[i]; if (D[i] < 0) D[i] += 26; if (i % 2 == 0) pos += D[i]; else neg += D[i]; cout << (pos % 26 == neg % 26 ? "da" : "ne") << nl; } exit(0-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...