제출 #438915

#제출 시각아이디문제언어결과실행 시간메모리
438915jam_xd_DNA 돌연변이 (IOI21_dna)C++17
43 / 100
1579 ms2408 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 diff = 0; int st1[3] = {0, 0, 0}; int st2[3] = {0, 0, 0}; for(int i=x; i<=y; i++) { if(A[i] == 'A') st1[0]++; else if(A[i] == 'T') st1[1]++; else if(A[i] == 'C') st1[2]++; /*-------------------------*/ if(B[i] == 'A') st2[0]++; else if(B[i] == 'T') st2[1]++; else if(B[i] == 'C') st2[2]++; if(A[i] != B[i])diff++; } if(st1[0] != st2[0] || st1[1] != st2[1] || st1[2] != st2[2]) return -1; if(y-x <= 2){ if(y-x == 0)return 0; if(y-x == 1){ if(A[x] == B[x])return 0; else return 1; } if(A[x] == B[x] && A[x+1] == B[x+1] && A[y] == B[y]) return 0; else if(A[x] == B[x] || A[x+1] == B[x+1] || A[y] == B[y]) return 1; else return 2; } //case 3 if(st1[2] == 0 && st2[2] == 0)return diff/2; 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...