Bank

Time Limit: 2 sec / Memory Limit: 1024 MB

Score : 400400 points

Problem Statement

�N people, with ID numbers 11, 22, ……, �N, are lining up in front of a bank.
There will be �Q events. The following three kinds of events can happen.

  • 1 : The teller calls the person with the smallest ID number who has not been called.
  • 2 x : The person with the ID number �x comes to the teller for the first time. (Here, person �x has already been called by the teller at least once.)
  • 3 : The teller again calls the person with the smallest ID number who has already been called but has not come.

Print the ID numbers of the people called by the teller in events of the third kind.

Constraints

  • 1≤�≤5×1051≤N≤5×105
  • 2≤�≤5×1052≤Q≤5×105
  • There will not be an event of the first kind when all people have already been called at least once.
  • For each event of the second kind, the person with the ID number �x has already been called by the teller at least once.
  • For each event of the second kind, the person with the ID number �x will not come to the teller more than once.
  • There will not be an event of the third kind when all people who have already been called have come to the teller.
  • There is at least one event of the third kind.
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format, where event�eventi​ denotes the �i-th event:

�N �Q
event1event1​
event2event2​
⋮⋮
event�eventQ​

The description of each event

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值