#题面
#题目描述
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 astronomy observatories around the world, labelled by . According to the ICPC’s prediction, there will be events of two types, detailed below:
- 「1 y k q[1…k]」 (, , ): A new member of the ICPC joins the study, whose goal is to gather at least minutes of video of the asteroids in total. The new member has cameras and is going to install exactly one camera in each astronomy observatory labelled by . It is guaranteed that these integers are pairwise distinct. Let be the number of events of type 1 before this event, then this member is assigned the ID of .
- 「2 x y」 (, ): Each the camera installed at the -th astronomy observatory successfully gathers 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.
#输入格式
The input contains only a single case.
The first line of the input contains two integers and (), denoting the number of astronomy observatories and the number of events. Each of the next lines describes an event in formats described in the statement above, except that some parameters are encrypted in order to enforce online processing.
Let be the number of members you report in the last event of the second type. Note that before the first event of the second type is processed. For events of the first type, and are encrypted. The actual values of and are and . For events of the second type, are encrypted. The actual values of are , . In the expressions above, the symbol 「」 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.
#输出格式
For each event of the second type, print a single line. In this line, print an integer first, denoting the number of ICPC members whose goals are just reached after this event. Then print ascending integers, denoting the IDs of these ICPC members.
#输入输出样例
样例输入 #1
3 5
1 5 3 1 2 3
2 2 1
1 2 2 1 2
2 3 1
2 1 3
样例输出 #1
0
0
2 1 2
#思路
对于每一个观测者可以设置提醒闹钟,在 后检查是否满足结束条件。然后对于每一个观测站使用 std::set
或者 std::priority_queue
维护其闹钟序列即可。
#代码
1 |
|
1 |
|