제출 #1002050

#제출 시각아이디문제언어결과실행 시간메모리
1002050vjudge1DNA 돌연변이 (IOI21_dna)C++17
35 / 100
23 ms4956 KiB
#include"bits/stdc++.h"
#include "dna.h"

using namespace std;

const int sz = 1e5 + 5;

int pa[sz], pt[sz];
int n;

string s, t;

void init(string a, string b) {
	n = a.size();
	s = ' ' + a, t = ' ' + b;

	for (int i = 1; i <= n; i ++) {
		pa[i] = pa[i - 1], pt[i] = pt[i - 1];
		if ('A' == s[i] && 'T' == t[i]) {
			pa[i] ++;
		} else if ('T' == s[i] && 'A' == t[i]) {
			pt[i] ++;
		}
	}
}

int get_distance(int x, int y) {
	x ++, y ++;
	int pac = pa[y] - pa[x - 1];
	int ptc = pt[y] - pt[x - 1];
	if (pac != ptc) {
		return -1;
	} else {
		return pac;
	}
}
#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...