Submission #1131617

#TimeUsernameProblemLanguageResultExecution timeMemory
1131617HectonitBliskost (COI23_bliskost)C++20
0 / 100
64 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() { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(nullptr); int t = 1; //cin >> t; while (t--) { solve(); } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:52:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:53:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...