Collection of numbers

Your task is to write a program that mantains a collection of integer
numbers, possibly repeated, and that does the operation according to the
indications of the user:

- S x: Stores a copy of the number x given.

- C: Consults the greatest number of the collection.

- D: Deletes the greatest number of the collection (one of them, if it
  is repeated).

- I x: Increases the greatest number (one of them, if it is repeated) in
  x units.

- D x: Decreases the greatest number (one of them, if it is repeated) in
  x units.

Input

The input consists of a sequence of orders as the described ones, each
one in a line.

Output

For each done query, your program must print in a line the greatest
number in that moment. Also, it must print an error line for each
operation (except the store operation) when the collection does not have
any number, following the format of the instance.

Hint: Notice that the collection can have repeated elements. Moreover,
is necessary that your solution is very fast: if you have never used
heaps (priority_queue) or (map), you should take advantage to learn.
Perhaps asking in the forum... (when the contest ends, of course).

Author: Salvador Roura

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:11:00.456Z

© Jutge.org, 2006–2026.
https://jutge.org
