1838 - I2P(I)2019_Yang_CS_hw10 Scoreboard

Time

2019/11/19 21:00:00 2019/11/26 12:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11711 Dynamic 3D array
12501 Ape Society

11711 - Dynamic 3D array   

Description

In this problem, you are asked to design two functions
    1.

unsigned*** new_3d_array(unsigned n,unsigned m,unsigned k);

malloc an n*m*k 3D unsigned array, and then return its address. The main function will check the correctness of your array.

 

    2.

void delete_3d_array(unsigned ***arr);

Free the memory space of your array that was previously allocated by using malloc. Be careful about the memory uage of your program allocated dynamically so as to avoid MLE.

 

The two functions have been declared in function.h, and you are asked to complete the function definitions in function.c.

Your program should construct the 3D array by using only three malloc function calls. Notice that malloc is a time-consuming operation.

 

Note: for OJ submission:

       Step 1. Submit only your function.c into the submission block. (Please choose C compiler) 

       Step 2. Check the results and debug your program if necessary.

Input

Please refer to the main function.

The input only has one line, consisting of five positive integers t,n,m,k,r separated by space characters, where t is the number of tests, (n,m,k) represents the array size, and r is a parameter for testing. 

Note that n*m*k<=10000000 and t*n*m*k<=60000000

Output

In order to test your array's correctness, we will use your array to do some computations and output the results.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11711.c

Partial Judge Header

11711.h

Tags

Jinkela



Discuss




12501 - Ape Society   

Description

Morris is a smart ape. His work is to teach N small apes the rules in the ape society.
Morris wanted to know how much small apes learned, therefore, he held a midterm exam last week. The result of exam made Morris so mad that he decided to flunk M-last apes.

Morris has the names, grades, and ages of these apes.
Can you help Morris to find the M-last apes by following rules?

Between two apes, the ape with the greater grade is better than the other one.
If they have the same grades, the younger ape is better than the older ape.
If they have the same grades and ages, compare their names in lexicographical order. The ape with small name is better than the other one.

Input

Two integer NM on the first line.
The following N lines contain information of apes.
Each line is consisted of SGA representing the name, grade, age of an ape respectively.

  • ≤ ≤ 1,000
  • ≤ ≤ N
  • ≤ G, ≤ 100
  • ≤ |S≤ 10
  • it’s guaranteed that the names are different.

Output

Print M lines of apes’ name which will be flunked by Morris.
The output order is ascending order, which means the worst ape will be printed first, and then the second last, the third last, and so on.

Sample Input  Download

Sample Output  Download

Tags




Discuss