# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
886086 | tienbinh | Fortune Telling 2 (JOI14_fortune_telling2) | C++14 | 364 ms | 74316 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 name ""
#define all(x) x.begin(), x.end()
const int N = 2e5 + 7;
struct merge_sort_tree{
int _l, _r, _m;
vector<int> v;
merge_sort_tree *lt, *rt;
merge_sort_tree(int l, int r, const vector<int> &e) : _l(l), _r(r), _m((l + r) >> 1), v(r - l + 1) {
if(l == r) v[0] = e[l], lt = rt = NULL;
else {
lt = new merge_sort_tree(_l, _m, e);
rt = new merge_sort_tree(_m + 1, _r, e);
merge(all(lt->v), all(rt->v), v.begin());
}
}
int query(int qs, int qe, int x, int y) {
if(qe < _l || qs > _r) return 0 ;
if(qs <= _l && _r <= qe) return upper_bound(all(v), y) - lower_bound(all(v), x);
return lt->query(qs, qe, x, y) + rt->query(qs, qe, x, y);
}
};
int c_index[3 * N], tree[12 * N];
int a[N], b[N], c[N];
int n, m;
void build(int id , int l, int r) {
if(l == r){
tree[id] = c_index[l];
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... |