#include "dna.h"
#include<bits/stdc++.h>
using namespace std;
string given, target;
vector<pair<long long, long long>> count_a (100001), count_t (100001), count_c (100001);
void init(string a, string b) {
given = a;
target = b;
for (int i=0; i<a.size(); i++) {
if (a[i]=='A')
count_a[i].first+=1;
else if (a[i]=='T')
count_t[i].first+=1;
else
count_c[i].first+=1;
if (b[i]=='A')
count_a[i].second+=1;
else if (b[i]=='T')
count_t[i].second+=1;
else
count_c[i].second+=1;
}
}
int get_distance(int x, int y) {
if (((count_a[y].first-count_a[x].first)==(count_a[y].first-count_a[y].second)) && ((count_t[y].first-count_t[x].first)==(count_t[y].first-count_t[y].second)) && ((count_c[y].first-count_c[x].first)==(count_c[y].first-count_c[y].second))) {
if (y-x<=2) {
if (given[y]==target[y])
return 0;
else
return 1;
}
}
else {
return -1;
}
return 0;
}
# | 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... |