# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831775 | MrDeboo | DNA 돌연변이 (IOI21_dna) | C++17 | 0 ms | 0 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 "dna.h"
#include "bits/stdc++.h"
using namespace std;
int n;
int g[3][3][100000];
string f="ACT";
void init(std::string a, std::string b) {
n=a.size();
for(int i=0;i<3;i++){
for(int w=i;w<3;w++){
for(int j=0;j<n;j++){
if(a[j]==f[i]&&b[j]==f[w])g[i][w][j]++;
}
if(j)g[i][w][j]+=g[i][w][j-1];
}
}
}
int get_distance(int l, int r) {
int G[3][3];
for(int i=0;i<3;i++){
for(int w=0;w<3;w++)G[i][w]=g[i][w][r]-(l==0?0:g[i][w][l-1]);
}
int ans=G[0][1]+G[1][2]+G[0][2],a=n-ans*2-G[0][0]-G[1][1]-G[2][2];
return ans+(a/3)*2;
}