# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
788014 | jamkel | Mutating DNA (IOI21_dna) | C++17 | 25 ms | 6220 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;
#define st first
#define nd second
typedef long long ll;
vector<int>q(100000);
vector<vector<int>>p(6,vector<int>(100000));
void init(string a, string b)
{
for(int i=0;i<a.length();i++)
{
if(i>0)
{
q[i]+=q[i-1];
for(int w=0;w<6;w++)
{
p[w][i]+=p[w][i-1];
}
}
if(a[i]!=b[i])
{
q[i]++;
if(a[i]=='A' && b[i]=='T')
{
p[0][i]++;
}
if(a[i]=='A' && b[i]=='C')
{
p[1][i]++;
}
if(a[i]=='T' && b[i]=='C')
{
p[2][i]++;
}
if(a[i]=='T' && b[i]=='A')
{
p[3][i]++;
}
if(a[i]=='C' && b[i]=='T')
{
p[4][i]++;
}
if(a[i]=='C' && b[i]=='A')
{
p[5][i]++;
}
}
}
}
int get_distance(int x, int y)
{
if(x==0)
{
return (q[y]-min(p[0][y],p[3][y])-min(p[1][y],p[5][y])-min(p[2][y],p[4][y]));
}
return ((q[y]-q[x-1])-min(p[0][y]-p[0][x-1],p[3][y]-p[3][x-1])-min(p[1][y]-p[1][x-1],p[5][y]-p[5][x-1])-min(p[2][y]-p[2][x-1],p[4][y]-p[4][x-1]));
}
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... |