Mr. N, a kind CS teacher, has decided to give out presents to his hard working students! He has decided that a harder working student should get priority over a student that has slacked off. Unfortunately, some of Mr. N's students are trolls, and Mr. N will remove them from his list if he sees fit. Hoping to move up Mr. N's list, you decide to write a program to order the list.
Input Specification
The first line will have an integer , the number of queries that follow.
Lines will each contain one of three possible queries:
F x
: add student to the beginning of the listE x
: add student to the end of the listR x
: remove student from the list. is guaranteed to be a student already in the list.
is an integer .
Output Specification
Output the list, from beginning to end, with each number on a new line. It is guaranteed that the list will only contain distinct integers.
Subtasks
For of points, and each satisfies .
Sample Input
5
F 1
F 2
R 1
E 3
E 1
Sample Output
2
3
1
Comments
A new testcase has been added to kill unintended solutions, and the time limit has been dropped to 0.5s.
Is this test valid?
The correct output is
but polyglot's submission output
only.
Hey can anybody take a look at my submission and explain what I have done wrong here.
What happens if
x
has more than 1 digit?Also, in the future, you can ask for help in the dmoj discord.
Sorry, this is my first contest. Is the clipboard supposed to show us the program's output or is it disabled? My clipped solution is blank and I don't think it's my program.
Your output is clipped, meaning that it doesn't show the full output. For most contests on DMOJ, no output is shown at all.
ty
I have the sample case working but I instantly get WA when I test
A little new to C++ so i have no clue what im doing wrong, thanks!
EDIT: Never mind i'm just bad at copying and pasting :) Happy new year
this test is valid?
I don't think so because on the problem statement it says "It is guaranteed that the list will only contain distinct integers".
it can be ... the last list of my test is distinct(output)
No, because students that are already in the list cannot be inserted again. Also, students that are not in the list cannot be erased
No, since 1 is inserted twice without being removed in between.
ok ... tnx ...