1853 - I2P(II) 2019_Fall_Chen_practice4 Scoreboard

Time

2019/11/28 18:30:00 2019/12/12 18:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12521 Break my heart
12522 Thanos' Return

12521 - Break my heart   

Description

I have broken many girls' hearts into pieces. But none of them mad at me. None.

~ by anonymous surgeon

You're a surgeon, you need to mend those girls' hearts. Therefore you need a data structure to support some functions.


This question is about maintain a set that contains only integers.

There will be n instructions.

Each instruction will be either:

insert:

Insert a new element ai into the set. Note that if the element has already in the set, do nothing.

 

print:

print all the element in the set in increasing order.

 

min:

print the number in the set that is the smallest. If there's no number, do nothing.

 

range_erase:

You will have two integer l, r.

You need to erase all the elements ai in the set that l <= ai <= r

 

Hint: You can solve this question very fast by using std::set .

These are some functions you may use in your code:

set.begin(), set.size(), set.erase(), set.lower_bound(), set.upper_bound(), set.insert(). To traverse through your set, you may also need iterator or type auto(only in c++11!)

You can also solve this question in C.

 

 

 

 

Input

the input will contain several lines.

The first line only contains an integer n (1 <= n <= 5000)

The following are n lines.

Each lines contains a instruction list above.

Note that ai (0 <= ai <= 10^9)

Output

 

For each print instruction, print all the number in the set in increasing order.

Each number is separated by a single blank.(No blank at the the end!)

Remember to print \n at the end of output

 

For each min instruction, print the smallest number in the set.

Remember to print \n at the end of output

Sample Input  Download

Sample Output  Download

Tags




Discuss




12522 - Thanos' Return   

Description

The Avengers finally gathered all the infinity stones together from different universe, and saved all lives that disappeared five years ago. However, Thanos comes again, from different universe. And this time, he'll eliminate the whole universe and create a new one, a grateful universe.

Thanos needs to compute how many energy he needs to consume to destruct and create a new universe. That is, he has to perform lots of matrix operations, including addition and multiplication. Now he threaten you to calculate these troublesome math, so that he can spend more time to deal with those ants ── those so called "Avengers".

thanos-thinking

Thanos thinking about this problem

If you click on this picture, something might happen...


You're given and , indicate the row number and column number of matrix .

An operation : + or *, and times will be given.

  • For operation +, you need to calculate and print the result.

    Note that:

  • For operation *, you need to calculate and print the result.

    Note that:


This problem is partial judge. Note that in this problem, you can and you must use C++ to solve this problem.

in function.h, we have implemented the interfaces and some implementations of the class Matrix for you. What you need to do is to implement the remaining functions.

Functions we have implemented:

  • Matrix()(constructor):

    Construct an empty Matrix object.

  • const int &getrow():

    Get the row number of the corresponding matrix.

  • const int &getcol():

    Get the column number of the corresponding matrix.

  • const int *operator[] (const int &x) const:

    Implement operator[] for Matrix class. Make private member mat can be viewed using [] only. For example, we can view M.mat[x][y] by accessing M[x][y] for a Matrix object M.

  • void print():

    The function to print the whole matrix.

Functions you have to implement:

  • Matrix(int r, int c)(constructor):

    Construct an Matrix with row = r and column = c, and all elements equals to 0.

  • int *operator[] (const int &x):

    Implement operator[] for Matrix class. Make private member mat can be accessed using [] only. For example, we can access M.mat[x][y] by accessing M[x][y] for a Matrix object M.

  • Matrix operator+ (const Matrix &x) const:

    Perform "addition" operation, then return the result.

  • friend Matrix operator* (const Matrix &x, const Matrix &y):

    Perform "multiplication" operation, then return the result. Note that this function is declared with friend.

In case of the result might be too large, all numbers should be module by 10007.

UPDATE: All nubmers should be module by 10007, and should output the positive one.(-2395%10007=7612)

Input

The first line contains , , , and , respectively.

There are lines below. Each line contains numbers. These numbers indicate every element in matrix .

, , , where here incidates all elements in matrix .

Output

Output the result of the corresponding operation.

For output format, please refer to print function in function.h and the sample output.

Sample Input  Download

Sample Output  Download

Partial Judge Code

12522.cpp

Partial Judge Header

12522.h

Tags




Discuss