#include <bits/stdc++.h>
using namespace std;
string A, B;
void init(string a, string b) {
A = a;
B = b;
}
int get_distance(int x, int y) {
// Count number of 'A's and 'T's
int aA = 0, aT = 0, bA = 0, bT = 0;
for (int i = x; i <= y; ++i) {
if (A[i] == 'A') aA++;
else aT++;
if (B[i] == 'A') bA++;
else bT++;
}
if (aA != bA || aT != bT)
return -1;
int mismatch = 0;
for (int i = x; i <= y; ++i) {
if (A[i] != B[i]) mismatch++;
}
if (mismatch % 2 != 0)
return -1;
return mismatch / 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... |