Submission #1131616

#TimeUsernameProblemLanguageResultExecution timeMemory
1131616HectonitBliskost (COI23_bliskost)C++20
0 / 100
0 ms320 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve() { int n, q; cin >> n >> q; string a, b; cin >> a >> b; int sum = 0; for (int i = 0; i < n; i++) { int d = b[i] - a[i]; if ((i + 1) % 2 == n % 2) { sum += d; } else { sum -= d; } } if (sum == 0) { cout << "da\n"; } else { cout << "ne\n"; } for (int i = 0; i < q; i++) { char c; int idx; cin >> idx >> c; int d = b[idx] - a[idx]; if ((i + 1) % 2 == n % 2) { sum -= d; } else { sum += d; } a[idx] = c; d = b[idx] - a[idx]; if ((i + 1) % 2 == n % 2) { sum += d; } else { sum -= d; } if (sum == 0) { cout << "da\n"; } else { cout << "ne\n"; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int t = 1; //cin >> t; while (t--) { solve(); } }
#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...