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)
Hey there! I’m Sumeet Varma. I am extremely interested in Algorithms and Data Structures and so I do a lot of competitive programming. I am also a big fan of Counter-Strike, Politics and reading random answers on Quora.
My team (FruitSalad) came 1st in ACM ICPC ‘17 Kharagpur Regionals, 2nd in Kolkata Regionals and 7th in India Finals and we have qualified for World Finals. Also, I have been Red on Codeforces and the highest rated Indian programmer on Codeforces, Hackerrank and Topcoder in the past.
Currently, I am doing an internship at Directi (Bangalore) as a part of my project for final semester at DA-IICT, Gandhinagar.
Ask me anything!
Moderator note: We are very excited to host Sumeet for a Q&A session! He has a max rating of 2515 on Codeforces and 2173 on TopCoder, and you can see the graph going up consistently over the last 2.5 years. It's time to find out more about the person behind ...
Thoughts on better platform for beginners: TopCoder vs CodeChef
CodeChef is probably better than TopCoder for beginners. Although there are enough practice problems of all difficulty levels on both the websites,
the Long CodeChef contest is quite a nice format. However, I’m not sure about how difficult the long contest problems are. The last time I checked (quite a while ago) they were increasing in difficulty quite rapidly.
Immediate feedback is also really nice when you are beginning. However, don’t let this get you into bad habits such as not testing your code thoroughly on your own. Everyone at TopCoder learns that skill. I did, and I appreciate it to date.
CodeChef is also a growing platform, whereas I think TopCoder SRMs is a dying platform. I owe a lot of what I have learnt to TopCoder, but it is what it is.
Shiv Pratap Singh asked me a bunch of questions about the Facebook internship application. I can't be 100% sure about the application specifics, but 95% certain based on my past experiences.
Shiv: I am in 2nd year in my college and next semester I will be looking for internships. I saw from your linkedin profile you interned at FB. I gave FB Hacker Cup first time and qualified upto 2nd round. Can you help me for that in any way?
Keshav: FB likes people who are active in CP and perform well. Just submit your resume on their website. If you know anyone in FB (same college, etc), contact them and tell them you submitted your resume. But you don't need to do more than that. Just need to submit resume and tell someone inside the company to make sure it gets looked at. If they come to your campus, that would be the better place to do it.
Shiv: So, you also performed in hackercup to get internship? I have 1856 rating on CF just -44 from purple. I think my CP skills are good because CodeNation organized their Internship challeng...