# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
810549 | rainboy | Bliskost (COI23_bliskost) | C11 | 182 ms | 15868 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 <stdio.h>
#define N 1000000
int main() {
static char aa[N + 1], bb[N + 1];
int n, q, i, d;
scanf("%d%d%s%s", &n, &q, aa, bb);
if (n == 1) {
printf(aa[0] == bb[0] ? "da\n" : "ne\n");
while (q--) {
static char s[2];
scanf("%d%s", &i, s), i--;
aa[i] = s[0];
printf(aa[0] == bb[0] ? "da\n" : "ne\n");
}
} else {
d = 0;
for (i = 0; i < n; i++)
d = (d + (aa[i] - 'a') * (i % 2 == 0 ? 1 : -1)) % 26;
for (i = 0; i < n; i++)
d = (d - (bb[i] - 'a') * (i % 2 == 0 ? 1 : -1)) % 26;
printf(d == 0 ? "da\n" : "ne\n");
while (q--) {
static char s[2];
scanf("%d%s", &i, s), i--;
d = (d - (aa[i] - 'a') * (i % 2 == 0 ? 1 : -1)) % 26;
aa[i] = s[0];
d = (d + (aa[i] - 'a') * (i % 2 == 0 ? 1 : -1)) % 26;
printf(d == 0 ? "da\n" : "ne\n");
}
}
return 0;
}
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... |