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;
vector<int> A,B;
void init(string a, string b){
for(auto i:a){
if(i=='A')A.push_back(0);
else if(i=='T')A.push_back(1);
else A.push_back(2);
}
for(auto i:b){
if(i=='A')B.push_back(0);
else if(i=='T')B.push_back(1);
else B.push_back(2);
}
}
int get_distance(int x, int y){
long long all =0;
int lol[3][3];
memset(lol,0,sizeof lol);
for(int i = x;i<=y;i++){
lol[A[i]][B[i]]++;
}
for(int i = 0;i<3;i++){
lol[i][i] = 0;
for(int j = i+1;j<3;j++){
int mi = min(lol[i][j],lol[j][i]);
all+=mi;
lol[i][j]-=mi;
lol[j][i]-=mi;
}
}
int su = 0;
for(int i = 0;i<3;i++){
for(int j = 0;j<3;j++){
su+=lol[i][j];
}
}
all+=su/3*2;
return all;
}
# | 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... |