Submission #438913

#TimeUsernameProblemLanguageResultExecution timeMemory
438913RodoXD0606Mutating DNA (IOI21_dna)C++17
21 / 100
48 ms2372 KiB
#include "dna.h" #include <iostream> using namespace std; string A,B; void init(std::string a, std::string b) { A=a;B=b; } int get_distance(int x, int y) { if(y-x<=2){ int C1[3]={0,0,0}; int C2[3]={0,0,0}; for(int i=x;i<=y;i++){ if(A[i]=='A') C1[0]++; if(A[i]=='T') C1[1]++; if(A[i]=='C') C1[2]++; if(B[i]=='A') C2[0]++; if(B[i]=='T') C2[1]++; if(B[i]=='C') C2[2]++; } if(C1[0]!=C2[0] || C1[1]!=C2[1] || C1[2]!=C2[2]) return -1; if(y-x<=2){ if(y-x==0) return 0; if(y-x==1){ if(A[x]==B[x]) return 0; return 1; } if(A[x]==B[x] && A[x+1]==B[x+1] && A[y]==B[y]) return 0; if(A[x]==B[x] || A[x+1]==B[x+1] || A[y]==B[y]) return 1; return 2; } if(C1[2]==0 && C2[2]==0){ int c=0; for(int i=x;i<=y;i++) if(A[i]!=B[i]) c++; return c/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...