#Lutece0325. Losing Weight
Losing Weight
Migrated from Lutece 325 Losing Weight
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
LSJ is trying hard to lose weight. But we all know,it's a long way to go, because LSJ just can't resist the temptation of the delicious food. As we all know, there are so many kinds of delicacies in the world. Suppose we now have m kinds of delicacies. Everyday, LSJ can get n dishes of delicacies, we call it a LSJ sequence
: . And ( and ), specifying that the dish is a delicacy. LSJ is very lazy and gluttonous. Everyday, he just chooses some dishes for his dinner, that is a sequence: , , and then eats them all! So, LSJ is fatter and fatter day by day…
As a good friend of LSJ, LYM often feels anxious about LSJ's health. She has tried but failed so many times to persuade LSJ to eat less! Finally, LYM comes up with an idea, hoping that it will stop LSJ from overeating. LSJ and LYM make an agreement: LYM gives a sequence of length : ( and ),if LSJ could find:$d_{i_1}=f_1, d_{i_2}=f_2, d_{i_3}=f_3\cdots d_{i_k}=f_k$ () in LSJ sequence
, LSJ could eat them all;But however,if LSJ couldn't find them, he can't eat anything thus to lose some weight, we call this a LYM sequence
.
Everyday in the morning, LYM can get LSJ sequence
, but LYM is also so lazy,╮(╯▽╰)╭. She will pick up a number randomly, but she doesn't know if there exists a LYM sequence
of length . So she comes to you, the clever ACMer ,please give her the answer.
Input
In the first line of the input is an integer , indicates the number of test cases. In each test case,the first line contains two integers, (), (). The second line contains integers,indicating LSJ sequence
.Then a line contains one integer ().
Output
For each test case, output one line. First ,output Case #C:
, where is the number of test case, from to . Then, if LYM could find a LYM sequence
length of ,output Great! LSJ will lose some weight...
on a single line,otherwise just output Horrible! LSJ will become fatter...
.
Samples
2
5 3
2 3 1 3 2
2
5 3
2 3 1 3 2
1
Case #1: Great! LSJ will lose some weight...
Case #2: Horrible! LSJ will become fatter...
Note
- In the first case,LYM can find a
LYM sequence
of length :1 1
- In the second case,there are three sequence length of :
1,2,3
; But LSJ could find any of them inLSJ sequence
,so there doesn't exist aLYM sequence
length of . - In fact we all know,LSJ tries to lose weight by doing exercise rather than going on a diet.
Resources
hz