# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1053234 | Zicrus | Mutating DNA (IOI21_dna) | C++17 | 1592 ms | 3272 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>
#include "dna.h"
using namespace std;
typedef long long ll;
string a, b;
vector<ll> sum;
void init(string a1, string b1) {
a = a1; b = b1;
sum = vector<ll>(a.size()+1);
for (int i = 1; i <= a.size(); i++) {
sum[i] = sum[i-1] + (a[i-1] != b[i-1]);
}
}
int get_distance(int x, int y) {
ll offA = 0;
for (int i = x; i <= y; i++) {
if (a[i] == 'A') offA++;
if (b[i] == 'A') offA--;
}
if (offA != 0) return -1;
ll cnt = sum[y+1] - sum[x];
return cnt / 2;
}
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... |