# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
531591 | erke | Type Printer (IOI08_printer) | C++11 | 136 ms | 120144 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;
struct Node {
bool isLeaf;
vector<Node*> adj;
int dep, far;
Node(): isLeaf(false), adj(26, nullptr), dep(0), far(-1) {}
};
struct Trie {
Node* root;
Trie() { root = new Node; }
void insert(Node* &node, int pos, string &s) {
if (node == nullptr) node = new Node;
if (pos == (int) s.size()) {
node->isLeaf = true;
return;
}
insert(node->adj[s[pos] - 'a'], pos + 1, s);
node->dep = max(node->dep, node->adj[s[pos] - 'a']->dep + 1);
if (node->far == -1 || node->adj[s[pos] - 'a']->dep > node->adj[node->far]->dep) {
node->far = s[pos] - 'a';
}
}
void insert(string &s) {
insert(root, 0, s);
}
};
# | 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... |
# | 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... |