a_gt3_rs's blog

By a_gt3_rs, history, 3 hours ago, In English

Is this problem doable with less than $$$O(n\sqrt{n}log(log(n)))$$$ time?

Given an array $$$p$$$, assuming $$$p_i=O(n)$$$. The array is cut to $$$O(\sqrt{n})$$$ blocks.

There is only one kind of query:

$$$1\ i\ j\ k$$$: Count the numbers from block $$$i$$$ to block $$$j$$$ such that $$$p_k$$$ is a multiple of (the query must be done in $$$O(1)$$$).

Any help is appreciated.

  • Vote: I like it
  • +1
  • Vote: I do not like it

»
75 minutes ago, # |
  Vote: I like it +1 Vote: I do not like it

Just don't split it into blocks, you can do it in O(nlog^2) with offline queries