| AlgoChief Sprint Round 4 |
|---|
| Finished |
Alice and Bob are playing a game of cards.
You have a total of $$$n$$$ cards to be distributed among each other. You are also given a parameter $$$k$$$
Alice and Bob are given the cards in a particular order, and they have to play the game in that particular order only.
Example : if Bob gets = $$$[3, 2, 1]$$$, it means he needs to play $$$3$$$ first, then $$$2$$$, then $$$1$$$.
If the sum of values of Alice And Bobs Cards on a particular round exceed $$$k$$$, that means you have distributed the cards unfairly.
You can shuffle the cards in any order you want, you have to make sure that least number of pairs on a current round have sum exceeding $$$k$$$
It is guaranteed that $$$n$$$ is even
If there are multiple ways of shuffling cards with same minimum pairs, it is accepted
The first line of input contains 2 integers, $$$n$$$ and $$$k$$$ $$$(1 \leq n \leq 10^5)$$$ $$$(1 \leq k \leq 10^9)$$$
The second line of input contains $$$n$$$ integers, the card values $$$(1 \leq a[i] \leq 10^9)$$$
On the First line you need to print the minimum number of rounds such that the sum of Alice and Bobs Card Values are exceeding $$$k$$$
On the Second line you need to print $$$n / 2$$$ values, Representing Alice's Cards
On the Third line you need to print $$$n / 2$$$ values, Representing Bob's Cards
6 6 1 2 3 4 5 6
1 6 5 4 3 1 2
In the Sample Testcase, only the first pair $$$(6 + 3)$$$ is exceeding $$$6$$$, rest $$$2$$$ pairs are $$$ \lt = k$$$.
| Name |
|---|


