#include "dna.h"
#include <bits/stdc++.h>
using namespace std;
string a, b;
void init(string aa, string bb) {
a = aa; b = bb;
}
int get_distance(int x, int y) {
if (x == y) {
if (a[x] == b[x]) return 0;
return -1;
}
if (x + 1 == y) {
if (a[x] == b[x] && a[y] == b[y]) return 0;
if (a[x] == b[y] && a[y] == b[x]) return 1;
return -1;
}
if (x + 2 == y) {
if (a[x] == b[x] && a[x+1] == b[x+1] && a[x+2] == b[x+2]) return 0;
if (a[x] == b[x+1] && a[x+1] == b[x] && a[x+2] == b[x+2]) return 1;
if (a[x] == b[x+2] && a[x+1] == b[x+1] && a[x+2] == b[x]) return 1;
if (a[x] == b[x] && a[x+1] == b[x+2] && a[x+2] == b[x+1]) return 1;
if (a[x] == b[x+2] && a[x+1] == b[x] && a[x+2] == b[x+1]) return 2;
if (a[x] == b[x+1] && a[x+1] == b[x+2] && a[x+2] == b[x]) return 2;
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... |