# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1092925 | Trisanu_Das | Railway Trip 2 (JOI22_ho_t4) | C++17 | 519 ms | 70872 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 SegmentTree {
int size;
vector<pair<int, int>> seg;
const pair<int, int> ID = {0, 0};
pair<int, int> combine(pair<int, int> a, pair<int, int> b) {
if (a == ID) return b;
if (b == ID) return a;
int left = min(a.first, b.first);
int right = max(a.second, b.second);
return {left, right};
}
void init(int n, vector<pair<int, int>>& values) {
size = 1;
while (size < n) size <<= 1;
seg.assign(2 * size + 2, ID);
for (int i = 0; i < n; i++) seg[i + 1 + size] = values[i];
for (int i = size - 1; i >= 1; i--)
seg[i] = combine(seg[i << 1], seg[(i << 1) + 1]);
}
pair<int, int> query(int a, int b, int x, int l, int r) {
if (b < l || a > r) return ID;
if (a <= l && b >= r) return seg[x];
int mid = (l + r) >> 1;
# | 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... |