# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1009505 | induwara16 | 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.
int get_distance(int x, int y)
{
str a1 = a.substr(x, y);
str b1 = b.substr(x, y);
int n = a1.length(), c = 0;
int as = count(a1.begin(), a1.end(), 'A');
int cs = count(a1.begin(), a1.end(), 'C');
int ts = n - as - cs;
if ((as == n) || (cs == n) || (ts == n))
return 0;
if ((as == 0) || (cs == 0) || (ts == 0))
return 1;
bool same = false;
for (int i = 0; i < n; i++)
{
if (a1[i] == b1[i])
{
same = true;
break;
}
}
return same ? 1 : 2;
}