Submission #838963

#TimeUsernameProblemLanguageResultExecution timeMemory
838963AlfraganusMutating DNA (IOI21_dna)C++17
0 / 100
21 ms10844 KiB
#include "dna.h" // #include "grader.cpp" #include <bits/stdc++.h> using namespace std; vector<vector<int>> a1, a2, as, bs; void init(string a, string b) { int n = a.size(); for (int i = 0; i < n; i++) { if (a[i] == 'T') a[i] = 'B'; if (b[i] == 'T') b[i] = 'B'; } a1.resize(3, vector<int>(3)); as.resize(3, vector<int>(n + 1)); bs.resize(3, vector<int>(n + 1)); for (int i = 0; i < n; i++) { as[i + 1] = as[i]; as[i + 1][a[i] - 'A']++; bs[i + 1] = bs[i]; bs[i + 1][b[i] - 'A']++; a1[b[i] - 'A'][a[i] - 'A']++; } } int get_distance(int x, int y) { if (as[y][0] - as[x - 1][0] == bs[y][0] - bs[x - 1][0] && as[y][1] - as[x - 1][1] == bs[y][1] - bs[x - 1][1] && as[y][2] - as[x - 1][2] == bs[y][2] - bs[x - 1][2]) { int ans = y - x + 1; for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) ans -= min(a1[i][j], a1[j][i]); return ans; } return 0; }
#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...