# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
484613 | MrDeboo | DNA 돌연변이 (IOI21_dna) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dna.h"
using namespace std;
string a,b;
void init(std::string A, std::string B) {
a=A;
b=B;
}
int get_distance(int l, int r) {
vector<int>v(26);
for(int i=l;i<=r;i++){
v[a[i]-'a']++;
v[b[i]-'a']--;
}
for(int i=0;i<26;i++){
if(v[i]!=0)return -1;
}
if(l==r)return 0;
if(l+1==r)return 1-(a[l]==b[l]);
if(a[l]==b[l]&&a[l+1]==b[l+1])return 0;
if(a[l]==b[l]||a[l+1]==b[l+1]||a[l+2]==b[l+2])return 1;
return 2;
}