Author: Akash Choudhary
Tester: Chinmay Rakshit
Editorialist: Chinmay Rakshit
FAST INPUT-OUTPUT ,BUILT-IN FUNCTION C++,STL CONTAINER
Input contains n integers sort the integers in decreasing order of their count of binary bit (1) in them and them again sort the integers having the same bit count into increasing order.
The problem statement itself clear.
O(N^2) sorting will only pass the first subtask.
thus, you have to use quick sort or merge sort.Better will be to use sort function in algorithm.h
But still it is slow enough as to count the bits of each integer so we use inbuilt function
to count the bits set on.
But still it’s slow enough so now u have to use the fast input to pass the last subtask and thus, you will get full points.
The purpose of this question was to make the user understand the use of STL container and quickly create a strategy to overcome the TLE situation.
Tester’s solution can be found here.