# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
234277 | DS007 | Fortune Telling 2 (JOI14_fortune_telling2) | C++14 | 748 ms | 73748 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;
#define int long long
const int N = 2e5;
vector<int> t[N * 4];
int n, k, a[N], b[N], c[N];
void build(int v, int l, int r) {
if (l == r) {
t[v].push_back(c[l]);
return;
}
int mid = (l + r) / 2;
build(v * 2, l, mid);
build(v * 2 + 1, mid + 1, r);
merge(t[v * 2].begin(), t[v * 2].end(), t[v * 2 + 1].begin(), t[v * 2 + 1].end(), back_inserter(t[v]));
}
int last(int v, int l, int r, int tl, int tr) {
if (l == r) {
if (tl <= c[l] && c[l] <= tr)
return l;
else
return -1;
}
int mid = (l + r) / 2;
if (lower_bound(t[v * 2 + 1].begin(), t[v * 2 + 1].end(), tl) == upper_bound(t[v * 2 + 1].begin(), t[v * 2 + 1].end(), tr))
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... |