# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
825831 | Koyote | Selling RNA Strands (JOI16_selling_rna) | C++14 | 232 ms | 144956 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>
using namespace std;
template<class T> bool ckmin(T &u, const T &v) { return u > v ? (u = v, true) : false; }
template<class T> bool ckmax(T &u, const T &v) { return u < v ? (u = v, true) : false; }
int conv(char c) {
if (c == 'A') return 0;
if (c == 'U') return 1;
if (c == 'G') return 2;
return 3;
}
struct prefix_trie {
typedef array<int, 4> node;
vector<node> tree;
vector<pair<int, int>> range;
prefix_trie() : tree(1, node{}), range(1, {int(1e9), -1}) {}
void insert(const string &s, int idx) {
int cur = 0;
for (int i = 0; i < (int)s.size(); i++) {
int c = conv(s[i]);
if (!tree[cur][c]) {
tree[cur][c] = (int)tree.size();
tree.push_back(node{});
range.push_back({int(1e9), -1});
}
cur = tree[cur][c];
ckmin(range[cur].first, idx);
ckmax(range[cur].second, idx);
# | 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... |