제출 #1215597

#제출 시각아이디문제언어결과실행 시간메모리
1215597AblablaDNA 돌연변이 (IOI21_dna)C++20
22 / 100
1593 ms2376 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 egy = 0, ket = 0, har = 0, negy = 0;
	for(int i = x; i <= y; i++){
		if(a[i] == 'A'){
			egy++;
		} else if(a[i] == 'T'){
			ket++;
		}

		if(b[i] == 'A'){
			har++;
		} else if(b[i] == 'T'){
			negy++;
		}
	}

	if(egy != har && ket != negy){
		return -1;
	}

	int ans = 0;
	for(int i = x; i <= y; i++){
		if(a[i] != b[i]){
			ans++;
		}
	}

	ans /= 2;
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...