| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 9128 | Alphabetically order |
|
| 9168 | Fibonacci number |
|
| 9284 | Max-Heap |
|
| 9316 | Can You Escape? |
|
Description
Given two strings, output them in alphabetical order.
Note: the order is AaBbCcDd ... YyZz.
Input
The first line of input contains a positive integer t (t <= 10000), which indicates the number of test cases. For each case a line, there are two strings separated by a single space. The lengths of the strings are no more than 10000.
Output
For each case a line, output the two strings in alphabetical order, separated by a single space.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given a positive integer N, calculate the N'th Fibonacci number.
Input
For each case a line, there is a positive integer N. ( 1 <= N <= 1000 ) When N equals 0, it is the end of file.
Output
For each case a line, print the N'th Fibonacci number.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Please maintain a max-heap, which stores integers and is able to support following operations:
(1) PUSH k – Insert an integer k into the heap. k will fit in a 32-bit signed integer.
(2) POP – Delete the maximum element from the heap.
(3) TOP – Print the maximum element in the heap.
Input
There is only one set of commands. Each command occupies a line, and the total number of commands is less than or equal to 500000. You may assume that the number of elements stored in the heap will be no more than 10000 at any time.
Output
For each “TOP” command, output a line containing the value of the element on the top of the heap. In case that the heap is empty, print ”Null” instead.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given a map, how fast can you find the exit and then escape?
The map is a 2-dimensional grid of squares, each square is either free or filled with a wall. The exit is hidden among one of the free spaces.
You can move between adjacent free squares vertically or horizontally, diagonal movement is not allowed. You may not go across walls and leave the range of given map.
You have to arrive the position of button first (so that the exit appears) and then you can go to the exit.
Input
The input consists of several maps. Each map begins with a line containing two integer numbers R and C (1 <= R, C <= 4000) specifying the map size. Then there are R lines each containing C characters.
Each character is one of the following:
s : Your start position.
. : A free square that you can move.
b : The position of the button.
w : The wall.
e : The hidden exit.
The position of start point, button and exit are guaranteed to be difference.
There are exactly one button and exactly one exit.
There is one blank line after each map. The input is terminated by end of file.
9316: O( 4(R*C) ) can pass this case
9317: O( (R*C)2 ) can pass this case
9318: O( (R*C) lg (R*C) ) can pass this case
9319: O( R*C ) can pass this case
Output
For each map, print one line containing the sentence "Escape in S steps.", where S is the smallest possible number of step to escape. If no way to escape, output the string "No solution." instead.
One step is defined as a movement between two adjacent squares. Pressing button does not count as a step.