# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
716414 | kidlin | Mutating DNA (IOI21_dna) | C++17 | 33 ms | 6836 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.
#include<bits/stdc++.h>
using namespace std;
const int val = 1e5+5;
string s,t;
int T0[val],C0[val],A0[val],T1[val],A1[val],C1[val], res[val];
void init(string a,string b){
s='#' + a,t= '#' + b;
for(int i=1;i<s.size();i++)
{
if(s[i]=='T') T0[i]++;
T0[i]+=T0[i-1];
if(s[i]=='C') C0[i]++;
C0[i]+=C0[i-1];
if(s[i]=='A') A0[i]++;
A0[i]+=A0[i-1];
if(t[i]=='T') T1[i]++;
T1[i]+=T1[i-1];
if(t[i]=='C') C1[i]++;
C1[i]+=C1[i-1];
if(t[i]=='A') A1[i]++;
A1[i]+=A1[i-1];
if(t[i] != s[i]) res[i] ++;
res[i] += res[i-1];
}
}
int get_distance(int x, int y)
{
x ++, y ++;
int f = T0[y]-T0[x-1];
int f1 = T1[y]-T1[x-1];
int g = C0[y]-C0[x-1];
int g1 = C1[y]-C1[x-1];
int d = A0[y]-A0[x-1];
int d1 = A1[y]-A1[x-1];
if(f!=f1 || g!=g1 || d!=d1) return -1;
return (res[y]-res[x-1]+1)/2;
}
Compilation message (stderr)
# | 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... |