| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1081751 | raphael_heuchl | DNA 돌연변이 (IOI21_dna) | C++17 | 73 ms | 6608 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dna.h"
#include <iostream>
#include <map>
#include <vector>
int N;
std::vector<int> v[6];
std::map<std::string, int> mp = {{"AT", 0}, {"TA", 1}, {"AC", 2}, {"TC", 3}, {"CA", 4}, {"CT", 5}};
std::string A, B;
void init(std::string a, std::string b)
{
A = a;
B = b;
N = a.size();
for (int i = 0; i < 6; ++i)
v[i].resize(N + 1);
for (int i = 0; i < N; ++i)
for (char j : (std::string)"ACT")
for (char k : (std::string)"ACT")
{
if (j == k)
continue;
int curr = mp[(std::string)"" + j + k];
v[curr][i + 1] = v[curr][i] + (a[i] == j && b[i] == k);
}
}
int get_distance(int x, int y)
{
int AT = v[0][y + 1] - v[0][x];
int TA = v[1][y + 1] - v[1][x];
int AC = v[2][y + 1] - v[2][x];
int TC = v[3][y + 1] - v[3][x];
int CA = v[4][y + 1] - v[4][x];
int CT = v[5][y + 1] - v[5][x];
if (AT + AC != TA + CA || TA + TC != AT + CT)
return -1;
int swaps = std::min(TC, CT) + std::min(AT, TA) + std::min(AC, CA);
int TCT = std::max(TC, CT) - std::min(TC, CT);
int ATA = std::max(AT, TA) - std::min(AT, TA);
int CAC = std::max(AC, CA) - std::min(AC, CA);
return swaps + 2*TCT;
}
컴파일 시 표준 에러 (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... | ||||
