# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1142615 | sam12345678910112 | Mutating DNA (IOI21_dna) | C++20 | 0 ms | 0 KiB |
#include "dna.h"
#include<bits/stdc++.h>
using namespace std;
string A,B;
void init(string a, string b) {
A=a;
B=b;
}
int get_distance(int x, int y) {
int count;
map<char,int>m2;
map<char,int>m1;
ans=0;
for(int so=x;so<=y;so++){
if(A[so]!=B[so]){count++;m2[A[so]]+=1;m1[B[so]]+=1;}
}
if(m1['A']==m2['A']&&m1['C']==m2['C']&&m1['T']==m2['T']){
return max(0,count-1);
}
else {return -1;}
}