Oil Pipeline I
Time limit2sMemory limit1024 MB
Each type 2 event adds C to every plant whose pipeline passes station I, and the task lists the plants that start running.
- Level
Medium6 of 10
- Topics
- Segment tree, Implementation
- Solved
- No attempts yet
Problem
A new industrial complex keeps adding power plants. The complex has fuel stations numbered 1 to in a row, and each plant receives its fuel through these stations.
Two kinds of events occur.
- : A new power plant enters the complex. It runs only after it receives at least units of fuel. A pipeline is installed along stations 1 through . If plants entered before this one, the new plant is numbered .
- : Every plant with a pipeline that passes station receives units of fuel. If any plant starts running because of this event, print the count and the numbers of those plants. Plants that were already running before this event are not printed.
Input
The first line contains and , the number of stations and the number of events (, ). Each of the next lines describes one event.
Let be the number of plants that started running at the most recent type 2 event. A type 1 event is given as , and . A type 2 event is given as , and . (, , , )
The generated values of and are guaranteed to stay within range. The value of is 0 until the first type 2 event is processed.
Output
For each type 2 event, print one line. The line starts with the number of plants that started running, followed by their numbers in ascending order.