제출 #1234612

#제출 시각아이디문제언어결과실행 시간메모리
1234612gry3125DNA 돌연변이 (IOI21_dna)C++20
21 / 100
17 ms2372 KiB
#include "dna.h"
#include <bits/stdc++.h>

using namespace std;
string a, b;

void init(string aa, string bb) {
	a = aa; b = bb;
}

int get_distance(int x, int y) {
	if (x == y) {
		if (a[x] == b[x]) return 0;
		return -1;
	}
	if (x + 1 == y) {
		if (a[x] == b[x] && a[y] == b[y]) return 0;
		if (a[x] == b[y] && a[y] == b[x]) return 1;
		return -1;
	}
	if (x + 2 == y) {
		if (a[x] == b[x] && a[x+1] == b[x+1] && a[x+2] == b[x+2]) return 0;
		if (a[x] == b[x+1] && a[x+1] == b[x] && a[x+2] == b[x+2]) return 1;
		if (a[x] == b[x+2] && a[x+1] == b[x+1] && a[x+2] == b[x]) return 1;
		if (a[x] == b[x] && a[x+1] == b[x+2] && a[x+2] == b[x+1]) return 1;
		if (a[x] == b[x+2] && a[x+1] == b[x] && a[x+2] == b[x+1]) return 2;
		if (a[x] == b[x+1] && a[x+1] == b[x+2] && a[x+2] == b[x]) return 2;
		return -1;
	}
	return 0;
}
#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...