Submission #576283

#TimeUsernameProblemLanguageResultExecution timeMemory
576283AdnanboiMutating DNA (IOI21_dna)C++17
0 / 100
29 ms4492 KiB
#include <bits/stdc++.h> #include "dna.h" using namespace std; #define N 100005 vector<int> a(N),b(N),c(N),d(N),e(N),f(N); void init(string a, string b){ int n=a.size(); for(int i=0;i<n;i++){ if(a[i]=='A' && b[i]=='C') a[i+1]=a[i]+1; else if(a[i]=='A' && b[i]=='T') b[i+1]=b[i]+1; else if(a[i]=='C' && b[i]=='A') c[i+1]=c[i]+1; else if(a[i]=='C' && b[i]=='T') d[i+1]=d[i]+1; else if(a[i]=='T' && b[i]=='A') e[i+1]=e[i]+1; else if(a[i]=='T' && b[i]=='C') f[i+1]=f[i]+1; } } 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...