| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 521580 | marat0210 | DNA 돌연변이 (IOI21_dna) | C++17 | 31 ms | 4416 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <dna.h>
#include <bits/stdc++.h>
using namespace std;
vector <int> posa, posb;
void init(string a, string b)
{
int n = a.size();
for (int i = 0; i < n; ++i) {
if (a[i] == 'A') {
posa.push_back(0);
}
else if (a[i] == 'T') {
posa.push_back(1);
}
else if (a[i] == 'C') {
posa.push_back(2);
}
if (b[i] == 'A') {
posb.push_back(0);
}
else if (b[i] == 'T') {
posb.push_back(1);
}
else if (b[i] == 'C') {
posb.push_back(2);
}
}
}
int get_distance(int x, int y)
{
if (y - x == 2) {
bool ok = true;
for (int i = x; i <= y; ++i) {
if (posa[i] != posb[i]) {
ok = false;
break;
}
}
if (ok) {
return 0;
}
ok = true;
for (int i = x; i <= y; ++i) {
bool cur = false;
for (int j = x; j <= y; ++j) {
if (posa[i] == posb[j]) {
cur = true;
}
}
if (!cur) {
ok = false;
}
}
if (!ok) {
return -1;
}
ok = false;
for (int i = x; i <= y; ++i) {
if (posa[i] == posb[i]) {
ok = true;
break;
}
}
if (ok) {
return 1;
}
else {
return 2;
}
}
else if (y - x == 1) {
if (posa[x] == posb[x] and posa[y] == posb[y]) {
return 0;
}
else if (posa[x] == posb[y] and posb[x] == posa[y]) {
return 1;
}
else {
return -1;
}
}
else {
if (posa[x] == posb[x]) {
return 0;
}
else {
return -1;
}
}
}
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
