Submission #1081697

#TimeUsernameProblemLanguageResultExecution timeMemory
1081697raphael_heuchlMutating DNA (IOI21_dna)C++17
35 / 100
22 ms4956 KiB
#include "dna.h" #include <iostream> #include <vector> int N; std::string A, B; std::vector<int> wrongA = {0}; std::vector<int> wrongT = {0}; void init(std::string a, std::string b) { A = a; B = b; N = a.size(); wrongA.resize(N + 1); wrongT.resize(N + 1); for (int i = 1; i <= N; ++i) wrongA[i] = wrongA[i - 1] + (A[i-1] == 'A' && B[i-1] == 'T'), wrongT[i] = wrongT[i - 1] + (A[i-1] == 'T' && B[i-1] == 'A'); } int get_distance(int x, int y) { if (wrongA[y + 1] - wrongA[x] != wrongT[y + 1] - wrongT[x]) return -1; return wrongA[y + 1] - wrongA[x]; }
#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...