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 a;
string b;
int n;
vector<int> at;
vector<int> ta;
void init(std::string A, std::string B) {
a = A;
b = B;
n = a.size();
at.push_back(0);
ta.push_back(0);
int current_at = 0;
int current_ta = 0;
for (int i = 0; i < n; i++) {
if (a[i] == 'A' && b[i] == 'T') {
current_at++;
} else if (a[i] == 'T' && b[i] == 'A') {
current_ta++;
}
at.push_back(current_at);
ta.push_back(current_ta);
//printf("%d %d\n", current_at, current_ta);
}
}
int get_distance(int x, int y) {
int current_at = at[y+1] - at[x];
int current_ta = ta[y+1] - ta[x];
if (current_at != current_ta) {
return -1;
}
return current_at;
}
# | 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... |