subject

Salut ma puteti ajuta cu problema asta ? Date de intrare:
Pe prima linie se află două numere, N și M.

Pe următoarele linii se află N numere naturale, numerele de identificare a foilor aflate inițial pe masă(primul număr este asociat primei foi, al doilea număr este asociat celei de-a doua foi…).
Pe următoarele M linii se află operațiile ce trebuie făcute:

1 dacă trebuie extrasă prima foaie
2, urmat de o valoare X, dacă trebuie introdusă o nouă foaie la sfârșit, aceasta având numărul de identificare X.
Date de ieșire

Pe prima linie se va afișa numărul de foi rămase pe biroul lui Andrei în urma executării celor M operații, iar pe a doua linie, numerele de identificare ale acestora.
Restricții

1 ≤ N ≤ 900 000
1 ≤ M ≤ 400 000
Numerele de identificare sunt cuprinse intre 0 și 10 000
Dacă șirul nu mai conține niciun element și trebuie efectuată o operație de tip 1, operația nu va fi efectuată.

Exemplu
Date de intrare Date de ieșire
4 3 5
30 21 81 26 21 81 26 68 64
2 68
2 64
1

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:30
What does 21 pilots middle aged name as a band 15 years prior to them naming their band 21 pilots?
Answers: 1
question
Computers and Technology, 23.06.2019 22:50
What is an rss reader used for? for creating a user account on a social new site
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
Ahousehold consists of a married couple and their twin five-year old daughters. the couples children had no income and lived with their parents all of last year. how many exemptions can the couple claim on last years tax return or they file with the “ married filing jointly “ status? a. 4 b. 5 c. 3 d. 2
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
What is a dashed line showing where a worksheet will be divided between pages when it prints? a freeze pane a split box a page break a print title
Answers: 1
You know the right answer?
Salut ma puteti ajuta cu problema asta ? Date de intrare:
Pe prima linie se află două numere,...
Questions
question
Social Studies, 11.10.2019 00:30
question
Biology, 11.10.2019 00:30
Questions on the website: 13722367