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 "dna.h"
using namespace std;
#define N 100005
vector<int> a(N),b(N),c(N),d(N),e(N),f(N);
void init(string k, string u){
int n=k.size();
for(int i=0;i<n;i++){
a[i+1]=a[i]+(k[i]=='A' && u[i]=='C');
b[i+1]=b[i]+(k[i]=='A' && u[i]=='T');
c[i+1]=c[i]+(k[i]=='C' && u[i]=='A');
d[i+1]=d[i]+(k[i]=='C' && u[i]=='T');
e[i+1]=e[i]+(k[i]=='T' && u[i]=='A');
f[i+1]=f[i]+(k[i]=='T' && u[i]=='C');
}
}
int get_distance(int x, int y){
y++;
int A=a[y]-a[x];
int B=b[y]-b[x];
int C=c[y]-c[x];
int D=d[y]-d[x];
int E=e[y]-e[x];
int F=f[y]-f[x];
if (E!=A+B-C || F!=C+D-A)
return -1;
return B+D+max(A, C);
}
# | 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... |