# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1068014 | ezdp | Mutating DNA (IOI21_dna) | C++17 | 133 ms | 23656 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
template<class T> using matrix = vector<vector<T>>;
int n;
vector<matrix<int>> pref;
void init(string a, string b){
n = a.size();
for(int i = 0; i < n; i ++){
int A = (a[i] == 'A' ? 0 : (a[i] == 'T' ? 1 : 2));
int B = (b[i] == 'A' ? 0 : (b[i] == 'T' ? 1 : 2));
if(pref.empty()) pref.push_back(matrix<int>(3, vector<int>(3)));
else pref.push_back(pref.back());
++ pref.back()[A][B];
}
}
int get_distance(int x, int y){
matrix<int> left = (x ? pref[x - 1] : matrix<int>(3, vector<int>(3, 0)));
matrix<int> right = pref[y];
matrix<int> diff(3, vector<int>(3, 0));
for(int i = 0; i < 3; i ++){
for(int j = 0; j < 3; j ++){
diff[i][j] = right[i][j] - left[i][j];
}
}
int ans = 0;
for(int i = 0; i < 3; i ++) for(int j = i + 1; j < 3; j ++){
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |