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 <iostream>
using namespace std;
string s="",c="";
int a2[1001000]; int b2[1001000]; int ca[1000100]; int ct[1000100];
void init(string a, string b) {
s=a;
c=b; int n=s.size();
int g=0; int A=0,T=0;
for(int i=0;i<n;i++)
{
if(s[i]!=c[i])
{g++; if(s[i]=='A') A++; else T++; }
a2[i]=g;
ca[i]=A;
ct[i]=T;
}
}
int get_distance(int x, int y) {
int m=a2[y]-a2[x]+(s[x]!=c[x]); int q1=0,q2=0;
if(x==0)
{
q1=ca[y];
q2=ct[y];
}
else
{
q1=ca[y]-ca[x-1];
q2=ct[y]-ct[x-1];
}
if(q1!=q2) return -1;
else
return m/2;
return 0;
}
# | 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... |