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 "dna.h"
#include <bits/stdc++.h>
using namespace std;
string as, bs;
vector<int> mc1, mc2, mc3, mc4, mc5, mc6;
void init(string a, string b) {
as = a;
bs = b;
int n = a.length();
mc1.resize(n + 2, 0);
mc2.resize(n + 2, 0);
mc3.resize(n + 2, 0);
mc4.resize(n + 2, 0);
mc5.resize(n + 2, 0);
mc6.resize(n + 2, 0);
for (int i = 1; i <= n; ++i) {
mc1[i] = mc1[i - 1] + (as[i - 1] == 'A' && as[i - 1] != bs[i - 1]);
mc2[i] = mc2[i - 1] + (bs[i - 1] == 'A' && as[i - 1] != bs[i - 1]);
mc3[i] = mc3[i - 1] + (bs[i - 1] == 'T' && as[i - 1] != bs[i - 1]);
mc4[i] = mc4[i - 1] + (bs[i - 1] == 'T' && as[i - 1] != bs[i - 1]);
mc5[i] = mc5[i - 1] + (bs[i - 1] == 'C' && as[i - 1] != bs[i - 1]);
mc6[i] = mc6[i - 1] + (bs[i - 1] == 'C' && as[i - 1] != bs[i - 1]);
// printf("i : %d, %d %d %d\n", i, acount1[i], acount2[i],
// mc[i]);
}
}
int get_distance(int x, int y) {
int c1 = mc1[y + 1] - mc1[x];
int c2 = mc2[y + 1] - mc2[x];
int c3 = mc3[y + 1] - mc3[x];
int c4 = mc4[y + 1] - mc4[x];
int c5 = mc5[y + 1] - mc5[x];
int c6 = mc6[y + 1] - mc6[x];
if (c1 != c2 || c3 != c4 || c5 != c6)
return -1;
return c1 + c3 + c5;
}
# | 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... |