# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
942294 | Ghetto | Homework (CEOI22_homework) | C++17 | 511 ms | 325104 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;
using pii = pair<int, int>;
const int MAX_N = 1e6 + 5;
string str;
int n;
set<int> commas_at_depth[4 * MAX_N]; // Starts at 1
int type[4 * MAX_N]; // 1 = min, 2 = max, 3 = leaf
int n_nodes;
int l_child[4 * MAX_N], r_child[4 * MAX_N];
void build(int u, int l, int r, int d) {
// cout << u << " " << l << " " << r << " " << d << endl;
if (l == r) {
type[u] = 3;
return;
}
type[u] = (str[l + 1] == 'i') ? 1 : 2;
int i = *commas_at_depth[d].lower_bound(l);
l_child[u] = ++n_nodes; r_child[u] = ++n_nodes;
build(l_child[u], l + 4, i - 1, d + 1);
build(r_child[u], i + 1, r - 1, d + 1);
}
void precomp() {
for (int i = 0; i < str.size(); i++) n += (bool) (str[i] == '?');
int depth = 0;
for (int i = 0; i < str.size(); i++) {
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... |