Submission #1059564

#TimeUsernameProblemLanguageResultExecution timeMemory
1059564NeroZeinBliskost (COI23_bliskost)C++17
0 / 100
1 ms600 KiB
#include "bits/stdc++.h" using namespace std; #ifdef Nero #include "Deb.h" #else #define debug(...) #endif void check(string s, string t) { int n = (int) s.size(); for (int i = 0; i < n - 1; ++i) { int diff = t[i] - s[i]; if (diff >= 0) { s[i] += diff; s[i + 1] += diff; } else { t[i] += -diff; t[i + 1] += -diff; } } cout << (s[n - 1] == t[n - 1] ? "da" : "ne") << '\n'; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, q; cin >> n >> q; string s, t; cin >> s >> t; check(s, t); while (q--) { int p; char c; cin >> p >> c; s[p - 1] = c; check(s, t); } 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...