| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 10769 | Two-dimensional array rotation |
|
| 12879 | Flash Card Game |
|
Description
Given an NxN two-dimensional array M, you are asked to rotate M clockwise by 45 degrees and print out the content of M.
Consider the following 2D array:

After being rotated 45 degrees clockwise, it will become:

In this case, you should print:
1
4 2
7 5 3
8 6
9
Input
The first line has N (2<=N<=20), which means the size of the 2D array. The total number of elements in the 2D array is thus N x N.
For the next N lines, each contains N integers, specifying the elements of the 2D array. All of the integers in the same line are separated by a space.
Output
Print out all elements of the rotated 2D array row-by-row.
All of the integers in the same line are separated by a space, and there is a '\n' at the end of each line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Sammy and Rachel are playing a flash card game. There are four flash cards on the table, each with an integer (either positive or negative) written on it. In each turn, one of them will pick a flash card. Sammy starts first. In the end of the game, both of them have exactly two flash cards.
The scoring rule for Sammy and Rachel are different. The score of Sammy is the number of flash cards he has with positive even number. The score of Rachel is the number of flash cards she has with negative even number.
Given the four flash cards, please output the winner or this game is a tie (平手) if both of them plays optimally. ("Plays optimally" here means that Sammy and Rachel will always pick the flash cards that helps them win in the end. Refer to sample io for example.)
Notes for sample io for the first sample input
The four flash cards given are {7, 1, 2, -2}. Below is a possible way for them to play optimally.
-
In the first round, Sammy will not pick either 7 or 1 because Sammy will neither get score or make it difficult for Rachel to get score. Let's say Sammy picks 2 in this round.
-
In the second round, Rachel will pick one card from {7, 1, -2}. Rachel will definitely pick -2 so that she can get the most score.
-
In the third round, Sammy will pick one card from {7, 1}. Let's say Sammy picks 1 in this round.
-
In the fourth round, Rachel will pick 7.
-
In the end, Sammy picked 2, 1, his score is 1 because he has one positive even number; Rachel picked -2, 7 and her score is 1. Since their score are equal, the game is a tie.
Note that another possible way for the to play optimally is that Sammy picked -2, 1 and Rachel picked 2, 7. In this case both of them have score equal to 0 and the game is a tie as well.
Input
Each test data contains four integers x1, x2, x3, x4 separated with a single space, representing the numbers on the four flash cards.
It is guaranteed that -1000 <= x1,x2,x3,x4 <= 1000 and x1,x2,x3,x4 ≠ 0.
Output
Print the name of the winner in one line. If they have equal score in the end, print "Tie". Remember to add new line character (\n) in the end of output.