| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1009621 | induwara16 | DNA 돌연변이 (IOI21_dna) | C++17 | 1546 ms | 4432 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 <bits/stdc++.h>
using namespace std;
typedef string str;
typedef vector<int> vi;
str a, b;
void init(std::string a1, std::string b2)
{
a = a1;
b = b2;
}
int get_distance(int x, int y)
{
str a1 = a.substr(x, y);
multiset<char> a2(a1.begin(), a1.end()), b2(b.begin() + x, b.begin() + y + 1);
str b1(b2.begin(), b2.end());
int n = a1.length();
int as = b1.find_last_of('A'), cs = b1.find_last_of('C'), ts = b1.find_last_of('T');
int ac, cc, tc;
if (as == b1.npos)
ac = 0;
else
ac = as + 1;
if (cs == b1.npos)
cc = 0;
else
cc = cs - ac + 1;
if (ts == b1.npos)
tc = 0;
else if (cc == 0)
tc = ts - ac + 1;
else
tc = ts - cs + 1;
cout << ac << ',' << cc << ',' << tc << '\n';
if (!equal(a2.begin(), a2.end(), b2.begin()))
return -1;
if ((ac == n) || (cc == n) || (tc == n))
return 0;
if ((ac == 0) || (cc == 0) || (tc == 0))
return 1;
bool same = false;
for (int i = 0; i < n; i++)
{
if (a1[i] == b1[i])
{
same = true;
break;
}
}
return same ? 1 : 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... | ||||
