# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
529182 | Icebear16 | Mutating DNA (IOI21_dna) | C++17 | 0 ms | 0 KiB |
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 "dna.h"
int n,q;
void init(std::string a, std::string b) {
}
int get_distance(int x, int y) {
int h1,h2,l1,l2,k1,k2;
for(int i=x;i<=y;i++){
if(a[i]=='A'){
h1++;
}else if(a[i]=='T'){
l1++;
}else if(a[i]=='C'){
k1++;
}
if(b[i]=='A'){
h2++;
}else if(b[i]=='T'){
l2++;
}else if(b[i]=='C'){
k2++;
}
}
if(h1==h2 && l1==l2 && k1==k2){
int j=0;
for(int i=x;i<=y;i++){
if(a[i]!=b[i]){
j+=1;
}
}
if(j%2==1){
j+=1;
}
return j/2;
}else{
return -1;
}
}