# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
888488 | fanwen | Bliskost (COI23_bliskost) | C++17 | 153 ms | 21992 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define file(name) \
if(fopen(name".inp", "r")) \
freopen(name".inp", "r", stdin), freopen(name".out", "w", stdout);
const int MAX = 1e6 + 5;
int n, a[MAX], b[MAX], q;
long long sum[2];
bool check() {
return (sum[0] - sum[1]) % 26 == 0;
}
void you_make_it(void) {
cin >> n >> q;
for (int i = 1; i <= n; ++i) {
char x; cin >> x; a[i] = x - 'a';
sum[i & 1] -= a[i];
}
for (int i = 1; i <= n; ++i) {
char x; cin >> x; b[i] = x - 'a';
sum[i & 1] += b[i];
}
cout << (check() ? "da" : "ne") << '\n';
while(q--) {
int p; char x; cin >> p >> x;
sum[p & 1] += a[p];
a[p] = x - 'a';
sum[p & 1] -= a[p];
cout << (check() ? "da" : "ne") << '\n';
}
}
signed main() {
#ifdef LOCAL
freopen("TASK.inp", "r", stdin);
freopen("TASK.out", "w", stdout);
#endif
file("bliskost");
auto start_time = chrono::steady_clock::now();
cin.tie(0), cout.tie(0) -> sync_with_stdio(0);
you_make_it();
auto end_time = chrono::steady_clock::now();
cerr << "\nExecution time : " << chrono::duration_cast <chrono::milliseconds> (end_time - start_time).count() << "[ms]" << endl;
return (0 ^ 0);
}
// Dream it. Wish it. Do it.
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |