Submission #570589

#TimeUsernameProblemLanguageResultExecution timeMemory
570589HanksburgerMutating DNA (IOI21_dna)C++17
100 / 100
35 ms4936 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; const int sz=100005; int a[sz], b[sz], c[sz], d[sz], e[sz], f[sz]; void init(string s, string t) { int len=s.length(); for (int i=0; i<len; i++) { a[i+1]=a[i]+(s[i]=='A' && t[i]=='C'); b[i+1]=b[i]+(s[i]=='A' && t[i]=='T'); c[i+1]=c[i]+(s[i]=='C' && t[i]=='A'); d[i+1]=d[i]+(s[i]=='C' && t[i]=='T'); e[i+1]=e[i]+(s[i]=='T' && t[i]=='A'); f[i+1]=f[i]+(s[i]=='T' && t[i]=='C'); } } int get_distance(int x, int y) { y++; int A=a[y]-a[x]; int B=b[y]-b[x]; int C=c[y]-c[x]; int D=d[y]-d[x]; int E=e[y]-e[x]; int F=f[y]-f[x]; if (E!=A+B-C || F!=C+D-A) return -1; return B+D+max(A, C); }
#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...