409662: GYM103671 C End Time

Memory Limit:1024 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. End Timetime limit per test2 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard output

This is an interactive problem. You have to use a flush operation right after printing each line. For example, in C++ you should use the function fflush(stdout), in Java — System.out.flush(), in Pascal — flush(output) and in Python — sys.stdout.flush().

Definitions

A permutation of length $$$n$$$ is a sequence of $$$n$$$ integers between $$$1$$$ and $$$n$$$ inclusive, such that each number appears exactly once.

When a string $$$s$$$ gets shifted, all characters except the last move to the right by one position. The last character moves to the beginning. For example, the string "End Time" can be shifted to read "eEnd Tim".

Let $$$\Sigma = \{a, b, ..., z, A, B, ..., Z\}$$$, in other words the set of lowercase and uppercase characters from the English alphabet. When a character $$$c$$$ in $$$\Sigma - \{z, Z\}$$$ gets shifted, it becomes the alphabetically next character of the same case. In particular, $$$z$$$ gets shifted to $$$A$$$, and $$$Z$$$ gets shifted to $$$a$$$.

Problem Statement

It is a sunny, but humid day as your time comes to an end. You are given a single integer $$$n$$$ $$$(1 \leq n \leq 100)$$$. Your last words are a sequence of $$$26n$$$ messages $$$m_1, m_2, ..., m_{26n}$$$, each of which is a string of length $$$26n$$$ consisting only of characters from $$$\Sigma$$$.

However, your last words have been misinterpreted, and the following transformation has occurred! A permutation $$$p$$$ of length $$$26n$$$ is picked. The $$$i$$$th message becomes the $$$p_i$$$th message. Afterwards, for each message $$$m_i$$$, two integers $$$a_i$$$ and $$$b_i$$$ are chosen from the range $$$[0, 52n - 1]$$$, inclusive. $$$m_i$$$ first gets shifted $$$a_i$$$ times. Then, for all $$$j$$$, the $$$j$$$th character of $$$m_i$$$ gets shifted $$$b_i(j - 1)$$$ times.

You see what your last words have been misinterpreted as. With your consciousness slowly fading, you are determined to figure out the permutation $$$p$$$.

Interaction

Your program is given a single integer $$$n$$$ ($$$1 \leq n \leq 100$$$).

After reading in the integer, your program should output $$$26n$$$ lines, the $$$i$$$th line consisting of the message $$$m_i$$$. It must be true that each $$$m_i$$$ contains exactly $$$26n$$$ characters, and each character is a lowercase or uppercase letter.

The judge program will then respond with the $$$26n$$$ transformed strings, each of which is on a separate line.

Finally, your program should output $$$26n$$$ space-separated integers on a single line. The $$$i$$$th integer is what your program thinks $$$p_i$$$ is.

In order to pass a test case, the guessed permutation must be exactly correct, even if multiple permutations are possible.

ExampleInput
1

acegikmoqsuwyACEGIKMOQSUWY
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxENDxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxTIMExxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
Output
aaaaaaaaaaaaaaaaaaaaaaaaaa
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxENDxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxTIMExxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Note

The choices for $$$a_1$$$ and $$$b_1$$$ for the first message are $$$20$$$ and $$$2$$$, respectively. Miraculously, the chosen permutation was the identity, and for all other lines, $$$a_i$$$ and $$$b_i$$$ were chosen to both be $$$0$$$.

加入题单

算法标签: