# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
986958 | kachim2 | Mutating DNA (IOI21_dna) | C++17 | 26 ms | 5908 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 "dna.h"
#include <algorithm>
#include <vector>
#include <array>
std::array<std::array<std::vector<int>, 3>, 3> aaa;
std::array<int, 256> chtoi = {};
void init(std::string a, std::string b) {
chtoi['A'] = 0;
chtoi['T'] = 1;
chtoi['C'] = 2;
for (auto &i : aaa) {
for (auto &j : i) {
j.resize(a.size()+1);
std::fill(j.begin(), j.end(), 0);
}
}
for (int i = 0; i < a.size(); i++) {
for (auto &A : aaa) {
for (auto &j : A) {
j[i+1] = j[i];
}
}
aaa[chtoi[a[i]]][chtoi[b[i]]][i] ++;
}
}
int get_distance(int x, int y) {
int ret = 0;
std::array<std::array<int, 3>, 3> bbb;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (aaa[i][j][y + 1] - aaa[i][j][x] !=
aaa[j][i][y + 1] - aaa[j][i][x]) {
return -1;
} else {
ret+= aaa[i][j][y + 1] - aaa[i][j][x];
}
}
}
return ret;
}
Compilation message (stderr)
# | 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... |