| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 13183 | Did you attack my village again? |
|
Description
Jennifer has an one dimension village in Coin Master. One day, Shirley attacked her village agian. Jennifer wants to detect the locations of the remaining houses in her village after being attacked. There are four types of instructions in this game, described as follows.
House: Jennifer can insert a house by using “House x ”. For example: Using “House 9 ” means Jennifer insert a house at 9.
Bomb: Shirley can attack Jennifer’s village by using “Bomb a d”. The houses located at |x-a| ≤ d will be vanished. For example: Using "Bomb 2 3" means if there is a house located in [-1, 5], it will be vanished.
PrintFront: Print out the houses’ locations (x value) in Jennifer’s village from small to large (i,e, Lexicographic order)
PrintEnd: Print out the houses’ locations (x value) in Jennifer’s village from large to small (i.e. reverse Lexicographic order)
Input
The first line contains an integer N, representing the number of instructions
The following N lines represent the order of the instruction and coordinate position.
Each line starts with a string si, representing the type of instruction. si will be one of the following strings: House, Bomb, PrintFront, or PrintEnd.
If si is House, si is followed by an integer x, representing x coordinate.
If si is Bomb, si is followed by two integers a and d, representing x coordinate and distance.
If si is PrintFront or PrintEnd, there will be no more following input in the same line.
It is guaranteed that:
- Test case #1 ~ #3: N ≤ 60, -1010 < x, a < 1010, -5000 < d < 5000
- Test case #4: N ≤ 1000, -1010 < x, a < 1010, -5000 < d < 5000
- Test case #5: N ≤ 30000, -1010 < x, a < 1010, -5000 < d < 5000
Output
For each instruction, you need to output the answer with the following format.
If the instruction is House or Bomb, you do not need to output anything.
If the instruction is PrintFront, print the text “PrintFront” first, and then print out the house locations (x value) in Jennifer’s village from small to large (Notice: Each location will be printed in one line with the form of “x”. For example, you’ll print out 3 lines if there’re two locations - one for “PrintFront”, two for the locations). If there is no house in the village, just print "PrintFront".
If the instruction is PrintEnd, print the text “PrintEnd” first, and then print out the house locations (x value) in Jennifer’s village from large to small (Notice: Each location will be printed in one line with the form of “x”. For example, you’ll print out 3 lines if there’re two locations - one for “PrintEnd”, two for the locations). If there is no house in the village, just print "PrintEnd".