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>
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <set>
#include "dna.h"
#include <cstdio>
#include <cassert>
#include <string>
using namespace std;
string A;
string B;
void init(string a,string b){
A = a;
B = b;
}
int get_distance(int x, int y){
vector <int> v(6,0);
for(int i = x; i <= y;i++){
if(A.at(i) == 'A'){
if(B.at(i) == 'T'){
v[2]++;
}else if(B.at(i) == 'C'){
v[0]++;
}
}else if(A.at(i) == 'C'){
if(B.at(i) == 'A'){
v[1]++;
}else if(B.at(i) == 'T'){
v[4]++;
}
}else{
if(B.at(i) == 'A'){
v[3]++;
}else if(B.at(i) == 'C'){
v[5]++;
}
}
}
if(abs(v[0] - v[1]) == abs(v[2] - v[3]) && abs(v[0] - v[1]) == abs(v[4] - v[5])){
int res = 0;
res += min(v[0],v[1]);
res += min(v[2],v[3]);
res += min(v[4],v[5]);
v[0] = abs(v[0] - v[1]);
res += 2 * v[0];
return res;
}else{
return -1;
}
}
# | 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... |