# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
878389 | TAhmed33 | Tourism (JOI23_tourism) | C++98 | 5079 ms | 111700 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;
#pragma GCC optimize ("Ofast")
const int MAXN = 4e5 + 25;
#define mid ((l + r) >> 1)
#define tl (node + 1)
#define tr (node + 2 * (mid - l + 1))
struct SegmentTree {
int tree[2 * MAXN];
void add (int l, int r, int a, int node) {
if (l == r) {
tree[node]++; return;
}
if (a <= mid) add(l, mid, a, tl);
else add(mid + 1, r, a, tr);
tree[node] = tree[tl] + tree[tr];
}
void rem (int l, int r, int a, int node) {
if (l == r) {
tree[node]--; return;
}
if (a <= mid) rem(l, mid, a, tl);
else rem(mid + 1, r, a, tr);
tree[node] = tree[tl] + tree[tr];
}
int get1 (int l, int r, int a, int node) {
if (!tree[node] || r < a) return -1;
if (l == r) return l;
int x = get1(l, mid, a, tl);
if (x != -1) return x;
# | 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... |