제출 #936101

#제출 시각아이디문제언어결과실행 시간메모리
936101AtabayRajabliDNA 돌연변이 (IOI21_dna)C++17
0 / 100
25 ms4536 KiB
#include <bits/stdc++.h> #include "dna.h" using namespace std; int n; int p[7][1000005]; string ax = " ACATCT"; string bx = " CATATC"; void init(string a, string b) { n = a.size(); a = ' ' + a; b = ' ' + b; for(int i = 1; i <= n; i++) { if(a[i] == b[i])continue; for(int j = 1; j <= 6; j++) { if(a[i] == ax[j] && b[i] == b[j])p[j][i]++; p[j][i] += p[j][i - 1]; } } } int get_distance(int x, int y) { ++x, ++y; int s[7] = {0}; for(int i = 1; i <= 6; i++) { s[i] = p[i][y] - p[i][x - 1]; } int ans = 0; int sx[4] = {0}, j = 1; for(int i = 1; i < 6; i += 2, j++) { if(s[i] != s[i + 1])return -1; ans += s[i]; sx[j] += s[i]; } sort(sx + 1, sx + 1 + 3); return ans + sx[1] + min(sx[2], sx[3]); }
#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...