#P6013. [CSGRound3] 压岁钱
[CSGRound3] 压岁钱
Description
There are events in total, and the events are divided into the following types.
- Xiao Z receives yuan of lucky money.
- Xiao Z spends yuan of lucky money to buy skins.
- Xiao Z seals yuan of his money. The seal will be lifted second before event happens. It is guaranteed that each time, the money Xiao Z currently has is greater than or equal to the amount being sealed.
If Xiao Z does not have enough money to spend on some event, Xiao Z will feel unhappy. At the same time, when he does not have enough money, Xiao Z will not spend the money.
Please tell Xiao Z in how many events he will not have enough money to spend.
Input Format
The first line contains an integer , which indicates the total number of events.
The next lines each start with an integer , indicating the type of the event.
If or , then it is followed by an integer .
If , then it is followed by two integers .
Output Format
Output one line with one integer, indicating the number of events in which there is not enough money to spend.
3
1 10
2 20
2 10
1
5
1 10
3 5 5
2 10
1 10
2 20
1
Hint
[Sample 1 Explanation]
Day 1: Income yuan, balance yuan.
Day 2: Not enough to spend yuan, balance yuan.
Day 3: Spend yuan, balance yuan.
Total: day.
[Sample 2 Explanation]
Day 1: Income yuan, balance yuan.
Day 2: Seal yuan, balance yuan.
Day 3: Not enough to spend yuan, balance yuan.
Day 4: Income yuan, balance yuan.
Day 5: The seal is lifted, spend yuan, balance yuan.
Total: day.
[Constraints]
For of the testdata, .
For of the testdata, .
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号