Submission #585317

#TimeUsernameProblemLanguageResultExecution timeMemory
585317cfalasMutating DNA (IOI21_dna)C++17
56 / 100
38 ms6644 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; int Aa[200000]; int Ta[200000]; int Ca[200000]; int Ab[200000]; int Tb[200000]; int Cb[200000]; int cc[200000]; void init(std::string a, std::string b) { int n = a.size(); for(int i=0;i<n;i++){ Aa[i+1] = Aa[i] + (a[i]=='A'); Ta[i+1] = Ta[i] + (a[i]=='T'); Ca[i+1] = Ca[i] + (a[i]=='C'); Ab[i+1] = Ab[i] + (b[i]=='A'); Tb[i+1] = Tb[i] + (b[i]=='T'); Cb[i+1] = Cb[i] + (b[i]=='C'); cc[i+1] = cc[i] + (a[i]==b[i]); //cout<<Aa[i+1]<<" "<<Ta[i+1]<<" "<<Ca[i+1]<<" "<<cc[i+1]<<endl; } } int get_distance(int x, int y) { x++, y++; int cnt = y-x+1; if(Aa[y]-Aa[x-1] != Ab[y]-Ab[x-1]) return -1; if(Ta[y]-Ta[x-1] != Tb[y]-Tb[x-1]) return -1; if(Ca[y]-Ca[x-1] != Cb[y]-Cb[x-1]) return -1; return (cnt - (cc[y]-cc[x-1]) + 1)/2; }
#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...