1708 - I2P(II)2019_Lee_Lab4 Scoreboard

Time

2019/06/04 13:20:00 2019/06/04 15:10:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
9416 Lexicographic Order
12316 Min-Heap

9416 - Lexicographic Order   

Description

There is a list of English words. Output them in lexicographic order. We compare the first character of two strings S1 and S2. If the ASCII code of the first character of Sis smaller than the first character of S2, we said that S1 is smaller than S2. Otherwise, if their first characters are the same, we compare their second characters, so on so forth until we can determine their order.  If S1 is S2’s prefix, S1 is smaller than S2 and vice versa.

Input

 There are multiple test cases.  Each case begins with an integer N in a line, and then N words follow, each word in a line.  The maximum length of words is 50.  The alphabets are 26 small English letters ‘a’ to ‘z’. The input is terminated if N = 0.

Case 1: 1 <= N <= 10
Case 2: 1 <= N <= 100
Case 3: 1 <= N <= 500
Case 4: 1 <= N <= 1000

Output

 For each test case, print the words in lexicographic order.    Print a blank line after each case.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12316 - Min-Heap   

Description

Please maintain a min-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 minimum element from the heap. Do nothing if no elements in heap.

(3) TOP – Print the minimum 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 15000 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