Олимпиадный тренинг

Задача 30684. Sets in C++


Input
Given a number N (1 <= N <= 100000) – number of requests. The following N lines contain the character ‘+’ or ‘-’ and the number a (1 <= a <= 1000000000). If the symbol – ‘+’, then the number a is added to the set, otherwise – removes all a values ​​that were previously added.
It is guaranteed that when a number is removed, it is contained in the set.

Imprint
It is required to display in ascending order all unique elements in the set after all queries are completed, or "-1" if there are no elements in the set.

 
Examples
# Input Output
1
3
+1
+2
-1
2
2
3
+1
+1
-1
-1
3
3
+1
+1
+1
1