이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dna.h"
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define MAX 100000
lli acu[MAX+2][3][3];
lli act[3][3];
void init(std::string a, std::string b) {
lli n = a.size();
lli x,y;
rep(i,0,n-1) {
if (a[i] == 'A') x = 0;
else if (a[i] == 'T') x = 1;
else x = 2;
if (b[i] == 'A') y = 0;
else if (b[i] == 'T') y = 1;
else y = 2;
rep(e,0,2) rep(j,0,2) acu[i][e][j] = acu[i-1][e][j];
acu[i][x][y]++;
}
}
int get_distance(int x, int y) {
rep(i,0,2) rep(j,0,2) act[i][j] = acu[y][i][j];
rep(i,0,2) rep(j,0,2) act[i][j] -= acu[x][i][j];
lli a,b,c,res = 0;
res += min(act[0][2], act[2][0]);
a = abs(act[0][2] - act[2][0]);
res += min(act[0][1], act[1][0]);
b = abs(act[0][1] - act[1][0]);
res += min(act[1][2], act[2][1]);
c = abs(act[1][2] - act[2][1]);
if (a == b && b == c) res += a*2;
else return -1;
return res;
}
# | 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... |