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;
typedef string str;
typedef vector<int> vi;
str a, b;
void init(std::string a1, std::string b2)
{
a = a1;
b = b2;
}
int get_distance(int x, int y)
{
str a1 = a.substr(x, y);
str b1 = b.substr(x, y);
int n = a1.length(), as = 0, cs = 0, ts = 0, as1 = 0, cs1 = 0, ts1 = 0;
bool same = false;
for (int i = 0; i < n; i++)
{
switch (a1[i])
{
case 'A':
as++;
break;
case 'C':
cs++;
break;
default:
ts++;
}
switch (b1[i])
{
case 'A':
as1++;
break;
case 'C':
cs1++;
break;
default:
ts1++;
}
if (a1[i] == b1[i])
same = true;
}
if ((as != as1) || (cs != cs1) || (ts != ts1))
return -1;
if ((as == n) || (cs == n) || (ts == n))
return 0;
if ((as == 0) || (cs == 0) || (ts == 0))
return 1;
return same ? 1 : 2;
}
# | 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... |