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;
vector<int> dif, match;
void init(string a, string b){
int n = a.size();
dif.clear();
match.clear();
dif.resize(n + 1);
match.resize(n + 1);
for (int i = 1; i <= n; i++){
match[i] = match[i - 1];
dif[i] = dif[i - 1];
if (a[i - 1] == 'A' && b[i - 1] == 'T'){
match[i]++;
dif[i]++;
}else if(a[i - 1] == 'T' && b[i - 1] == 'A'){
match[i]--;
dif[i]++;
}
}
}
int get_distance(int x, int y){
y++;
x++;
if (match[y] == match[x - 1]){
return (dif[y] - dif[x - 1]) / 2;
}else return -1;
}
# | 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... |