Submission #938540

#TimeUsernameProblemLanguageResultExecution timeMemory
938540Hugo1729Mutating DNA (IOI21_dna)C++17
35 / 100
33 ms4968 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; string a,b; int n; int prefa[100001]={0},prefb[100001]={0},prefm[100001]={0}; void init(string c, string d) { a=c;b=d; n=a.size(); for(int i=0;i<n;i++){ prefa[i+1]=prefa[i]; prefb[i+1]=prefb[i]; prefm[i+1]=prefm[i]; if(a[i]=='A')prefa[i+1]++; if(b[i]=='A')prefb[i+1]++; if(a[i]==b[i])prefm[i+1]++; } } int get_distance(int x, int y) { int dista=prefa[y+1]-prefa[x]; int distb=prefb[y+1]-prefb[x]; int distm=(prefm[y+1]-prefm[x]); if(dista!=distb)return -1; else{ return (y-x+1-distm)/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...