Submission #1108551

#TimeUsernameProblemLanguageResultExecution timeMemory
1108551sunboiMutating DNA (IOI21_dna)C++17
35 / 100
31 ms4376 KiB
#include <bits/stdc++.h> using namespace std; vector<int> dif, match; void init(string a, string b){ int n = a.size(); dif.clear(); match.clear(); dif.resize(n + 1); match.resize(n + 1); for (int i = 1; i <= n; i++){ match[i] = match[i - 1]; dif[i] = dif[i - 1]; if (a[i - 1] == 'A' && b[i - 1] == 'T'){ match[i]++; dif[i]++; }else if(a[i - 1] == 'T' && b[i - 1] == 'A'){ match[i]--; dif[i]++; } } } int get_distance(int x, int y){ y++; x++; if (match[y] == match[x - 1]){ return (dif[y] - dif[x - 1]) / 2; }else return -1; }
#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...