# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
437033 | WnRS | 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"
#include <bits/stdc++.h>
using namespace std;
string a,b;
int get_distance(int x, int y) {
int cnt=0, a=0,t=0,c=0;
for(int i = x ; i <= y ; i++) {
if(a[i] != b[i]) cnt++;
if(a[i]=='A') a++;
else if(a[i] == 'T') t++;
else c++;
if(b[i]=='A') a--;
else if(b[i]=='T') t--;
else c--;
}
return (!a&&!t&&!c?(cnt+1)/2:-1);
}
void init(string aa, string bb) {
a=aa,b=bb;
}