ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > CEN112 Questions 2016 > задача:


15-PE2-8. 50987 - Very Looong Queue

CEN112 Questions 2016

Старт: 30.мар.2016 в 15:10:22
Финиш: 01.апр.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (1)

Задачи турнира

• 15-PE-8. 50872 - Top M Grades
• 15-PE2-1. 50980 - The smallest rect...
• 15-PE2-2. 50981 - Top popular m-st...
• 15-PE2-2. 50984 - Top m hardworki...
• 15-PE2-2. 51086 - Top popular student
• 15-PE2-3. 50982 - A thief in labyrinth
• 15-PE2-4. 50983 - Course Selection
• 15-PE2-6. 50985 - Books Waiting
• 15-PE2-8. 50987 - Very Looong ...
• 15-RE-2. 50999 - Overlapping Trips
• 3. 51002 - The most successful classes
• 4. 51003 - Double Prime
• HW092. 51081 - Fish Pond I
• HW092. 51062 - Fish Pond II

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Very Looong Queue

Question: You are given the come and leave instructions for some people. Write a program, that reads a sequence of instructions. Then, show the final list after following the instructions.

Input specification
You will be given an integer in the beginning: the number of instructions (n). Then, in the following n lines you will be given n instructions. Every instruction starts with a letter and followed by a number (N):

  • C N: N people are coming to the end of queue. Then, you will be given the IDs of N people.
  • L N: N people are leaving from the beginning of the queue.
where 0 ≤ n ≤ 10,000 and people IDs are less than 25,000.

Output specification:
Show IDs of the people who are still in the queue. Show -1 if the queue is empty.

Sample Input I
5
C 5 10 16 1 18 11
L 2
L 3
C 4 15 20 13 3
L 2
Sample Input II
5
C 3 17 2 16
L 1
C 5 5 15 3 1 12
C 1 7
L 4
Sample Output I
13 3
Sample Output II
3 1 12 7



Для отправки решений необходимо выполнить вход.

www.contester.ru