Submit | All submissions | Best solutions | Back to list |
Problem hidden on 2014-01-16 18:22:39 by Mitch Schwartz
CHESSCM - Checkmate |
Annu loves playing chess. She is playing a game of chess with Kushagra. Now Annu is in a very dominating position. She has captured all the chess pieces of Kushagra. Only the King is left. And Annu have three chess pieces left - King, Queen and Knight. You know the positions of all the 4 chess pieces. If the current configuration of the pieces is checkmate for kushagra, then Kushagra had already lost. else Annu have one last turn to give checkmate to kushagra and defeat him. You have to predict that Kushagra lost the game or he has survived the last chance. If Kushagra lost the game print - "CHECKMATE" else print - "LUCKY" About Chess
The left-lowermost square is represented as [0,0] and the right-topmost square as [7,7].
Input
The first input line contains integer T (T<=10) which represents the number of testcases. For every testcase we have 8 integers. T1,T2,K1,K2,Q1,Q2,N1,N2. [0<=T1,T2,K1,K2,Q1,Q2,N1,N2<=7]. T1,T2 -> Position of Kushagra's King. K1,K2 -> Position of Annu's King. Q1,Q2 -> Position of Annu's Queen. N1,N2 -> Position of Annu's Knight. No two chess pieces lie on the same square.
Output
Print "CHECKMATE" if kushagra lost, else "LUCKY".
Sample tests
Input: 3 6 6 0 7 3 6 0 4 7 0 6 2 5 0 7 2 3 2 3 0 1 3 4 1 Output: LUCKY CHECKMATE CHECKMATE In first testcase there is no chance that Annu can give checkmate to Kushagra in one move.
In second testcase Kushagra is already in checkmate position.
In third testcase Annu can give checkmate to Kushagra in one move.
By moving the queen from [1,3] to [3,3].
New checkmate configuration -> 3 2 3 0 3 3 4 1
Added by: | Rajesh Kumar |
Date: | 2013-08-11 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | AASF - ABV-IIITM PC-11-8-2013 |
hide comments
2014-01-16 18:21:10 Mitch Schwartz
The example case 1 contradicts the answer I received in my previous comment. (I didn't look into solving this until now.) Based on my submission, the actual test data also contains such cases. Problem is hidden. The issue is that, if the initial configuration is not checkmate, we need to know whose turn it is in order for the problem to be well-defined. The reasoning behind my question was to know whether it is safe to assume that it is Annu's turn, which the language of the problem statement seems to imply, and which is also supported by the explanation of example case 3. If Kushagra is in check, then it can't be Annu's turn (according to the standard rules of chess). If we are supposed to consider both the case where it's Annu's turn (if possible) and the case where it's Kushagra's turn (if possible), this would also have to be stated clearly, as well as the precise conditions when we need to print CHECKMATE (i.e., (1) when all possible cases are checkmate, or (2) when at least one case is checkmate). @Rajesh Kumar: You may leave a new comment if you fix this and want the problem made visible again. Or if someone who got AC wants to state the set of assumptions they used, that could work too. Last edit: 2014-01-17 00:14:34 |
|
2013-09-24 18:09:42 Rana Saha
This was one hell of a Question.!! Took entire 1 day to solve! Loved it!! :D |
|
2013-09-12 03:02:06 Mitch Schwartz
"If the current configuration of the pieces is checkmate for kushagra, then Kushagra had already lost. else Annu have one last turn to give checkmate to kushagra and defeat him." So it's guaranteed that there's no case where Kushagra is in check but not checkmate? Additional: And it's guaranteed that the kings are not attacking each other? (An impossible position.) Reply:- Yes. (Mitch) Thanks for the reply. Last edit: 2013-09-12 09:12:31 |