F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

The Game

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 212    Accepted Submission(s): 63


Problem Description
Alice and Bob like playing Chinese Chess. One day they are playing a game: Alice has a General, Bob has a General and a Horse, they both obey the rules of Chinese Chess, which are:

$\bullet $ General has 4 moving directions, Horse has 8 moving directions, but they can't move out of the chess board or their own moving areas. See the picture to get more details:



$\bullet $ In some circumstances, Horse can't move to all his positions, just as you can see in the picture, it can move to the black positions, but can't move to the red positions:



$\bullet $ Two Generals can eat each other if and only if they have the same y-coordinate and Horse is not between them.
(For more information, click http://https://en.wikipedia.org/wiki/Xiangqi)

One is considered to be the winner only when his enemy's General is eaten. Please note that if the game is a tie, Alice is considered to be the winner. If Alice know that she has no chance to win the game at the beginning, she will take the strategy to make the game last more steps. If Alice can't win, Bob want to end the game as soon as possible.

If Alice win the game, output "Lucky guy!", else output "Lose in x steps T.T!", x indicates the number of steps they take (the sum of Alice's and Bob's steps). Suppose they all make best strategies.
 

Input
7 numbers $x_1,y_1,x_2,y_2,x_3,y_3,p$, where:

$\bullet $ $(x_1,y_1)$indicates the coordinate of the Bob's Horse $(0 \leq x_1 \leq 9, 0 \leq y_1 \leq 8)$;
$\bullet $ $(x_2,y_2)$indicates the coordinate of the Bob's General $(7 \leq x_2 \leq 9, 3 \leq y_2 \leq 5)$;
$\bullet $ $(x_3,y_3)$indicates the coordinate of the Alice's General $(0 \leq x_3 \leq 3, 3 \leq y_3 \leq 5)$;

$\bullet $ $p$ indicates the people who moves first, 0 for Alice, 1 for Bob.
 

Output
If Alice win, output "Lucky guy!" (without quotations), else output ¡°Lose in x steps T.T!¡±, x indicates the number of steps they take (the sum of Alice's and Bob's steps).
 

Sample Input
5 0 0 9 3 0 3 0 2 6 9 5 2 3 1 0 4 7 3 1 4 0 3 2 7 4 1 3 0 3 2 7 4 1 3 1
 

Sample Output
Lucky guy! Lose in 3 steps T.T! Lucky guy! Lose in 4 steps T.T! Lose in 1 steps T.T!
 

Hint

In sample 1, Alice moves first, she can eat Bob's General directly;
In sample 2, Bob move his Horse to $(0,5)$, then wherever Alice move her General, it will be eaten by Bob's Horse, so they take 3 steps in total.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-05 03:17:03, Gzip enabled