제출 #831933

#제출 시각아이디문제언어결과실행 시간메모리
831933JoksimKaktusDNA 돌연변이 (IOI21_dna)C++17
22 / 100
1575 ms3788 KiB
#include <bits/stdc++.h> #include <iostream> #include <vector> #include <cmath> #include <queue> #include <map> #include <algorithm> #include <iomanip> #include <set> #include "dna.h" #include <cstdio> #include <cassert> #include <string> using namespace std; string A; string B; void init(string a,string b){ A = a; B = b; } int get_distance(int x, int y){ vector <int> v(6,0); for(int i = x; i <= y;i++){ if(A.at(i) == 'A'){ if(B.at(i) == 'T'){ v[2]++; }else if(B.at(i) == 'C'){ v[0]++; } }else if(A.at(i) == 'C'){ if(B.at(i) == 'A'){ v[1]++; }else if(B.at(i) == 'T'){ v[4]++; } }else{ if(B.at(i) == 'A'){ v[3]++; }else if(B.at(i) == 'C'){ v[5]++; } } } if(abs(v[0] - v[1]) == abs(v[2] - v[3]) && abs(v[0] - v[1]) == abs(v[4] - v[5])){ int res = 0; res += min(v[0],v[1]); res += min(v[2],v[3]); res += min(v[4],v[5]); v[0] = abs(v[0] - v[1]); res += 2 * v[0]; return res; }else{ return -1; } }
#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...