Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя DPlayerGod

Автор DPlayerGod, история, 2 года назад, По-английски

Hope someone will be able to give me an idea about this problem :

John has N movie discs placed in a stack, which are numbered 1, 2 ... n from the top. For every time he takes a disc, John will skillfully pull the disc he wants to watch from the stack. And after using it later, he put this plate on top again, messing up the order. Now he has m discs to watch in turn, where on the stack he wants to watch it each time he watches the ith disc ?

Sample Input

5 3
4 4 5

Sample Output

4 1 5 

Note : n, m <= 1e5.

Thank you so much!

Полный текст и комментарии »

  • Проголосовать: нравится
  • -9
  • Проголосовать: не нравится