A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d3/d53/mo_8cpp_source.html below:

TheAlgorithms/C++: range_queries/mo.cpp Source File

7int

a[N], bucket[N], cnt[N];

14void add

(

int

index) {

16 if

(cnt[a[index]] == 1)

19void

remove(

int

index) {

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;

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]);

int main()

Main function.

std::string add(const std::string &first, const std::string &second)

Adding two string.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4