제출 #438129

#제출 시각아이디문제언어결과실행 시간메모리
438129josiftepeDNA 돌연변이 (IOI21_dna)C++17
43 / 100
1593 ms5576 KiB
#include <iostream> #include <vector> #include <algorithm> #include <cstring> #include "dna.h" using namespace std; const int maxn = 1e5 + 5; int a_pref_sum[maxn][4]; int b_pref_sum[maxn][4]; string a, b; int n; void init(string a, string b) { memset(a_pref_sum, 0, sizeof a_pref_sum); memset(b_pref_sum, 0, sizeof b_pref_sum); n = (int) a.size(); for(int i = 0; i < n; i++) { if(a[i] == 'C') a[i] = 'B'; if(b[i] == 'C') b[i] = 'B'; } for(int i = 0; i < n; i++) { if(a[i] == 'T') a[i] = 'C'; if(b[i] == 'T') b[i] = 'C'; } ::a = a; ::b = b; } int get_distance(int x, int y) { vector<int> c_a(3, 0), c_b(3, 0); for(int i = x; i <= y; i++) { c_a[a[i] - 'A']++; c_b[b[i] - 'A']++; } if(c_a[0] != c_b[0] or c_a[1] != c_b[1] or c_a[2] != c_b[2]) { return -1; } int diff = 0; for(int i = x; i <= y; i++) { if(a[i] != b[i]) { ++diff; } } return (diff + 1) / 2; }
#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...