#P14447. [ICPC 2025 Xi'an R] Azalea Garden
[ICPC 2025 Xi'an R] Azalea Garden
题目描述
In a serene garden of azaleas, dangerous creatures have appeared. Each creature possesses an and a . Initially, the -th creature () has an attack power of and a defense power of .
You, the guardian of the azalea garden, can mentally imagine a between them. A consists of several (possibly, ) . In each imagined , you choose two living creatures and (, ), and:
- If the attack power of creature is greater than or equal to the defense power of creature (i.e. ), then can defeat in the battle, and is considered eliminated.
- Otherwise, nothing happens.
Note that the are imaginary; that is, a creature eliminated cannot be used for future in the same , but it regains its vigor at the beginning of the next , and thus can participate in future of consequent .
The creatures are volatile and undergo mutations over time. You are given mutations. After each of the mutations, the attributes of a creature change. Specifically, in the -th mutation, the -th creature has its attack power updated to and its defense power updated to . Note that the mutations are persistent; After the -th mutation, the impacts of the first mutations are accumulated.
Since each remaining creature poses an ongoing threat to the flowers, you want to find the minimum possible number of creatures that remain after an optimal sequence of an imagined . You need to answer the question for all states before all mutations and after each mutation.
输入格式
The first line of the input contains two integers and (, ), where is the number of creatures and is the number of mutations.
The next lines of the input describe all the creatures. The -th line of these contains two integers and (), where is the attack power and is the defense power of the -th creature.
The next lines of the input describe all the mutations. The -th line of these contains three integers , , and (, ), where is the new attack power of creature and is the new defense power of creature .
输出格式
Output lines, each containing a single integer, which are the answers before any mutations and after each mutation in sequence.
3 1
1 1
2 2
3 3
2 2 4
1
2
提示
In the example, before the mutations begin, the third creature can defeat the first and second creatures. Clearly, this is the optimal sequence of imagined battles, so the answer is .
After the first mutation ends, the attack power of the second creature becomes , and its defense power becomes . Now the third creature can only defeat the first creature, leaving creatures remaining. It can be proved that no better solution exists, so the answer is .
京公网安备 11011102002149号