Submission #681981

#TimeUsernameProblemLanguageResultExecution timeMemory
681981rt144Mutating DNA (IOI21_dna)C++17
0 / 100
30 ms4912 KiB
#include "dna.h" #include <cassert> const int maxn = 1e5+5; std::string a, b; // 1-index int d1[maxn], d2[maxn], sm[maxn], n; void init(std::string A, std::string B) { a = A, b = B, n = A.size(); for (int i=1;i<=n;i++) { assert(A[i-1]!='C'&&B[i-1]!='C'); if (A[i-1]==B[i-1]) sm[i] = sm[i-1]+1; else if (A[i-1]=='A') d1[i] = d1[i-1]+1; else d2[i] = d2[i-1]+1; } } int get_distance(int x, int y) { x++, y++; int cd1 = d1[y]-d1[x-1], cd2 = d2[y]-d2[x-1]; if (cd1!=cd2) return -1; return cd1; }
#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...