제출 #672845

#제출 시각아이디문제언어결과실행 시간메모리
672845mseebacherDNA 돌연변이 (IOI21_dna)C++17
0 / 100
538 ms2368 KiB
#include <bits/stdc++.h> using namespace std; string origx, origy; string x,y; void init(string a, string b){ origx = a; origy = b; } int get_distance(int a, int b){ x = origx; y = origy; int cntA= 0; int cntT= 0; int cntC= 0; for(int i = a;i<=b;i++){ if(x[i] == 'C') cntC++; if(y[i] == 'C') cntC--; if(x[i] == 'A') cntA++; if(y[i] == 'A') cntA--; if(x[i] == 'T') cntT++; if(y[i] == 'T') cntT--; } if(cntC != 0 || cntA != 0 || cntT != 0) return -1; int erg = 0; for(int i = a;i<=b;i++){ if(x[i] != y[i]){ for(int j = i+1;j<=b;j++){ if(x[j] == y[i] ){ char c = x[i]; x[i] = x[j]; x[j] = c; erg++; break; } } } } return erg; }
#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...