7int a[
N], bucket[
N], cnt[
N];
16 if (cnt[a[index]] == 1)
21 if (cnt[a[index]] == 0)
26 if (x.l / bucket_size != y.l / bucket_size)
27 return x.l / bucket_size < y.l / bucket_size;
32 int n, t, i, j,
k = 0;
34 for (i = 0; i < n; i++) scanf(
"%d", &a[i]);
35 bucket_size = ceil(sqrt(n));
37 for (i = 0; i < t; i++) {
38 scanf(
"%d %d", &q[i].l, &q[i].r);
43 sort(q, q + t, mycmp);
44 int left = 0, right = 0;
45 for (i = 0; i < t; i++) {
46 int L = q[i].l, R = q[i].r;
59 while (right > R + 1) {
65 for (i = 0; i < t; i++) printf(
"%d\n", bucket[i]);
double k(double x)
Another test function.
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
std::string add(const std::string &first, const std::string &second)
Adding two string.