|| ||Code Submission Evaluation System
CSES - HIIT Open 2018
HIIT Open 2018
|Contest start:||2018-05-26 11:00:00|
|Contest end:||2018-05-26 16:00:00|
Task list | Submit code | Submissions | Messages | Scoreboard | Statistics
There is an $n \times n$ grid whose each square contains a character between A and Z. You can create a word by starting at the upper-left square and moving one step right or down on each step until you reach the lower-right square.
If you create a list of all such words and sort them lexicographically, what is the $k$th word in the list?
The first input line has two integers $n$ and $k$: the size of the grid and the parameter $k$.
After this, there are $n$ lines that describe the grid. Each line consists of $n$ characters between A and Z.
Print the requested word. You can assume that such a word exists.
Explanation: The list is [