# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
52224 | kriii | Fortune Telling 2 (JOI14_fortune_telling2) | C++17 | 678 ms | 39704 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 <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
const int Z = 1 << 18;
vector<int> G[Z * 2];
int N, K, A[200200], B[200200], T[200200];
int cnt(int x, int l, int r)
{
auto &v = G[x];
return upper_bound(v.begin(), v.end(), r) - lower_bound(v.begin(), v.end(), l);
}
int cnt(int x, int y, int l, int r)
{
int res = 0;
x += Z; y += Z;
while (x < y) {
if (x & 1) res += cnt(x++, l, r);
if (~y & 1) res += cnt(y--, l, r);
x /= 2; y /= 2;
} if (x == y) res += cnt(x, l, r);
return res;
}
int get(int l, int r)
{
int x = 1;
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... |