Блог пользователя pH7

Автор pH7, история, 4 года назад, По-английски

You are given two N size arrays A and B. Then you will have to answer Q queries : Given X -> If A[i] | B[j] = X for some i, j < N, print 1, else 0.

1 <= N, Q <= 100000 0 <= A[i], B[i] <= 100000

I tried to solve using trie, but i could not determine overall complexity. Can someone please help me solving this best possible way?

Note : This problem is not from any running contest.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

Автор pH7, история, 4 года назад, По-английски

Hi all! I was wondering about solution if in Spoj HORRIBLE we are required to get range multiplication instead of range sum. So basically how can we solve below problem ?

Given an array of N elements handle below two type of range queries. - Update L R v : Add v to each element in range [L, R] - Query L R : Get multiplication of each element in range [L, R]

I am out of ideas. Please help!

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится