Submission #1068014

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10680142024-08-21 06:40:37ezdpMutating DNA (IOI21_dna)C++17
100 / 100
133 ms23656 KiB
#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 ++){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...