#Lutece0362. Challenge Me
Challenge Me
Migrated from Lutece 362 Challenge Me
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
CC has a balance and some weights. But CC’s balance is so strange that it will keep balance whenever the left side is no more than Mg heavier or lighter than the right side. Now, CC wants to put all his weights on the balance, and each time he can choose an arbitrary one to put on the left side or right side as long as the one is legal, meaning that after which the balance should also keep balance. CC is wondering if he could successfully put all his weights on the balance. And as CC is an ACMer, he thinks that he can use greedy algorithm to solve this puzzle, so he wrote a program as follow.
I would like to explain some details about CC’s program here. Each time, CC chooses the heaviest one from all legal weights to put on the balance. If he could put it on the heavy side, he will do. Otherwise, he will put it on the lighter side. CC can’t prove his program is right, neither can he find counterexamples. He needs your help.
In this problem, CC will give some balance coefficients to you. Can you find a counterexample for him? A counterexample is legal while it consists of positive integers only. And among all counterexamples, you should choose the one has least number of weights. And if several counterexamples have a tie, you should choose the lexicographically smallest one. A counterexample , is lexicographically smaller than another one while we sort them in nondecreasing order, and the first position from left to right where , we have .
Input
The first line of the input is an integer (), which stands for the number of test cases you need to solve.
Every test case is an integer (), meaning the balance coefficient of CC’s balance.
Output
For every test case, you should output Case #k:
on a single line first, where indicates the case number and starts at . If you can’t find a counterexample for CC, only output NO
on a single line. Otherwise, you should output YES
on a single line first, and then on the next line output the number of weights in your counterexample, and finally on the next several lines output weights in nondecreasing order, where every weight occupies a line.
Samples
Resources
The 9th UESTC Programming Contest Preliminary