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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 04:40, debo4965
Amain idea is supported, explained, or expanded on with a numbers b. a concluding statement c. details d. a topic sentence. im e paragraphs reset nex next
Answers: 2
image
Computers and Technology, 22.06.2019 18:00, deathfire5866
Determine whether the following careers would require training or college.
Answers: 1
image
Computers and Technology, 22.06.2019 22:50, youngboymark123
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
image
Computers and Technology, 24.06.2019 00:00, miguelturner
Which tool could be used to display only rows containing presidents who served two terms
Answers: 3
You know the right answer?
Salut ma puteti ajuta cu problema asta ? Date de intrare:
Pe prima linie se află două numere,...

Questions in other subjects:

Konu
Social Studies, 09.11.2020 14:00
Konu
Mathematics, 09.11.2020 14:00
Konu
Mathematics, 09.11.2020 14:00
Konu
English, 09.11.2020 14:00