# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
831775 | MrDeboo | Mutating DNA (IOI21_dna) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}