# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
716251 | kidlin | 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<bits/stdc++.h>
#define int long long
#define endul endl
using namespace std;
const int val = 1e3+5;
const int inf = 2*(1e9+5);
const int mod = 1000000007;
int a[val];
int b[val
string s,t;
void init(string a,string b){
s=a,t=b;
}
int get_distance(int x, int y)
{
int T0=0,C0=0,A0=0,T1=0,A1=0,C1=0;
int res=0;
for(int j=x; j<=y; j++)
{
if(s[j]=='T') T0++;
if(s[j]=='C') C0++;
if(s[j]=='A') A0++;
if(t[j]=='T') T1++;
if(t[j]=='C') C1++;
if(t[j]=='A') A1++;
if(s[j]!=t[j]) res++;
}
if(T0!=T1 || C0!=C1 || A1!=A0)return -1;
if(res%2==0) return res/2 ;
return res/2+1 ;
}