| 2024 USP Try-outs |
|---|
| Finished |
Alikhan is preparing a Persian New Year party. The main attraction of the party will be a device where guests can add a song to the playlist that will be played for the entire party.
During the party, guest $$$i$$$ approaches the device at time $$$t_i$$$ and chooses a song of duration $$$m_i$$$ that will be added to the end of the playlist.
The device has one problem: the guest can press a button when choosing the song and skip the queue, interrupting the song that is currently playing and immediately starting the playback of the chosen song. The interrupted song will not be played again. Fortunately, if this happens, the rest of the queue remains unchanged.
Alikhan knows that if the song of guest $$$i$$$ is playing and is replaced, this guest will become very sad and will never show up at any of Alikhan's parties again (note that if someone presses the button at the moment when guest $$$i$$$'s song ends, this guest will not be sad). To remedy this situation, Alikhan needs to know all the guests whose songs were interrupted so that he can send a letter of apology the next day.
The first line contains a single integer $$$1 \leq n \leq 10^5$$$, the number of guests who added songs to the device. Each guest interacts with the device only once.
Each of the next $$$n$$$ lines contains three integers $$$t_i$$$, $$$m_i$$$, $$$c_i$$$ ($$$1 \leq t_i, m_i \leq 10^7$$$, $$$c_i \in \{0, 1\}$$$), the time when guest $$$i$$$ interacts with the device, the duration of the song, and whether they used the button to skip the queue or not, respectively. It is guaranteed that no two guests interact with the device at the same time. The value $$$c_i = 0$$$ if the button was not used by guest $$$i$$$, and $$$c_i = 1$$$ otherwise.
The output should contain two lines. The first line should contain $$$f$$$, the number of guests who became sad. The second line should contain $$$f$$$ numbers, the indices of the $$$f$$$ guests who became sad, separated by spaces. Any order of these indices will be accepted.
31 4 02 2 06 5 1
1 2
21 5 16 5 1
0
41 2 020 1 13 5 02 20 1
2 1 4
| Name |
|---|


