406601: GYM102452 I Incoming Asteroids

Memory Limit:512 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Incoming Asteroidstime limit per test2.0 smemory limit per test512 megabytesinputstandard inputoutputstandard output

The International Coalition to Prevent Catastrophes (ICPC) recently discovered several small asteroids in a nearby galaxy. If these asteroids hit the Earth, it will lead to a terrible disaster. So it is important for the ICPC to fully study the orbit trajectories of these asteroids. The ICPC consists of many member states, and due to the difference in development, they may have different goals in the study.

Orbits of Comet Kohoutek and the Earth. Public domain.

The ICPC has marked $$$n$$$ astronomy observatories around the world, labelled by $$$1,2,\cdots,n$$$. According to the ICPC's prediction, there will be $$$m$$$ events of two types, detailed below:

  • "1 y k q[1..k]" ($$$1\leq y\leq 10^6$$$, $$$1\leq k\leq 3$$$, $$$1\leq q_i\leq n\text{ for } 1 \le i \le k$$$): A new member of the ICPC joins the study, whose goal is to gather at least $$$y$$$ minutes of video of the asteroids in total. The new member has $$$k$$$ cameras and is going to install exactly one camera in each astronomy observatory labelled by $$$q_1,q_2,\dots,q_k$$$. It is guaranteed that these $$$k$$$ integers $$$q_1,q_2,\dots,q_k$$$ are pairwise distinct. Let $$$p$$$ be the number of events of type 1 before this event, then this member is assigned the ID of $$$p+1$$$.
  • "2 x y" ($$$1\leq x\leq n$$$, $$$1\leq y\leq 10^6$$$): Each the camera installed at the $$$x$$$-th astronomy observatory successfully gathers $$$y$$$ minutes of asteroid video. You need to report the number of ICPC members whose goals are just reached after this event, and the IDs of these members. Note that you shouldn't count the members whose goals have already been reached before this event.

You are an employee at the ICPC and your leader asks you to write a program to simulate these events, so that the ICPC may make appropriate preparations for the study.

Input

The input contains only a single case.

The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n,m \leq 2\cdot 10^5$$$), denoting the number of astronomy observatories and the number of events. Each of the next $$$m$$$ lines describes an event in formats described in the statement above, except that some parameters are encrypted in order to enforce online processing.

Let $$$last$$$ be the number of members you report in the last event of the second type. Note that $$$last=0$$$ before the first event of the second type is processed. For events of the first type, $$$y$$$ and $$$q_i \ (1\le i \le k)$$$ are encrypted. The actual values of $$$y$$$ and $$$q_i$$$ are $$$y\oplus last$$$ and $$$q_i\oplus last$$$. For events of the second type, $$$x,y$$$ are encrypted. The actual values of $$$x,y$$$ are $$$x\oplus last$$$, $$$y \oplus last$$$. In the expressions above, the symbol "$$$\oplus$$$" denotes the bitwise exclusive-or operation. Also note that the constraints described in the statement above apply to the corresponding parameters only after decryption, the encrypted values are not subject to those constraints.

Output

For each event of the second type, print a single line. In this line, print an integer $$$cnt$$$ first, denoting the number of ICPC members whose goals are just reached after this event. Then print $$$cnt$$$ ascending integers, denoting the IDs of these ICPC members.

ExampleInput
3 5
1 5 3 1 2 3
2 2 1
1 2 2 1 2
2 3 1
2 1 3
Output
0
0
2 1 2

加入题单

算法标签: