CommonLounge Archive

[Codechef COOK82C] Hussain Set

May 24, 2017

Problem in short:

Hussain has a multiset of integers. In every move Hussain removes a maximum number from this multiset and divides it by 2 (integer division, which is rounded down) , and re-inserts it into the multiset.

Answer Q Queries, i-th query denoted by Q[i]. You must tell the number Hussain will be dividing in the Q[i]-th move (after Q[i]-1 moves in particular).

Constraints: N, Q <= 10^6. Elements of multiset are less than 2^63 (signed long long)


© 2016-2022. All rights reserved.