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 <bits/stdc++.h>
using namespace std;
string x,y;
void init(string a, string b){
x = a;
y = b;
}
int get_distance(int a, int b){
int cntA= 0;
int cntT= 0;
int cntC= 0;
for(int i = a;i<=b;i++){
if(x[i] == 'C') cntC++;
if(y[i] == 'C') cntC--;
if(x[i] == 'A') cntA++;
if(y[i] == 'A') cntA--;
if(x[i] == 'T') cntT++;
if(y[i] == 'T') cntT--;
}
if(cntC != 0 || cntA != 0 || cntT != 0) return -1;
int erg = 0;
for(int i = a;i<=b;i++){
if(x[i] != y[i]){
for(int j = i;j<=b;j++){
if(x[j] == y[i] && x[j] != y[j]){
swap(x[i],x[j]);
erg++;
break;
}
}
}
}
return erg;
}
# | 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... |