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 <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include "dna.h"
#include <map>
using namespace std;
const int maxn = 1e5 + 5;
string a, b;
int n;
void init(string _a, string _b) {
n = (int) a.size();
a = _a;
b = _b;
}
int get_distance(int x, int y) {
map<char, int> a_m, b_m;
for(int i = x; i <= y; i++) {
a_m[a[i]]++;
b_m[b[i]]++;
}
if(a_m['A'] != b_m['A']) return -1;
if(a_m['C'] != b_m['C']) return -1;
if(a_m['T'] != b_m['T']) return -1;
int diff = 0;
for(int i = x; i <= y; i++) {
if(a[i] != b[i]) {
++diff;
}
}
return (diff + 1) / 2;
}
# | 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... |