제출 #1029395

#제출 시각아이디문제언어결과실행 시간메모리
1029395elpro123DNA 돌연변이 (IOI21_dna)C++17
21 / 100
20 ms3920 KiB
#include "dna.h" #include "bits/stdc++.h" using namespace std; string s, s2; int n; void init(string a, string b){ s = a; s2 = b; n = (int)s.size(); } int get_distance(int x, int y){ int a1=0, a2=0, c1=0, c2=0, t1=0, t2=0; for(int i=x; i<=y; ++i){ if(s[i] == 'A'){ a1++; } if(s[i] == 'C'){ c1++; } if(s[i] == 'T'){ t1++; } if(s2[i] == 'A'){ a2++; } if(s2[i] == 'C'){ c2++; } if(s2[i] == 'T'){ t2++; } } if(a1!=a2 || t1!=t2 || c1!=c2){ return -1; } int check=1; for(int i=x; i<=y; ++i){ check &= (s[i] == s2[i]); } if(check){ return 0; } int ans=-1; for(int i=x; i<=y; ++i){ ans += (s[i] != s2[i]); } return ans; }
#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...