Codeforces Round 887 (Div. 1) |
---|
Finished |
The red pandas are in town to meet their relatives, the blue pandas! The town is modeled by a number line.
The pandas have already planned their meetup, but the schedule keeps changing. You are given $$$q$$$ updates of the form x t c.
The updates will be given in order of non-decreasing $$$x$$$ values. After each update, please print the maximum number of friendships if the red pandas move in an optimal order based on all the updates given in the input above (and including) this update.
The order in which a red panda moves can change between updates.
The first line contains $$$q$$$ ($$$1 \leq q \leq 2 \cdot 10^5$$$) – the number of updates.
The $$$i$$$-th line of the next $$$q$$$ lines consists of $$$3$$$ integers $$$x_i$$$, $$$t_i$$$ and $$$c_i$$$ ($$$0 \leq x_i \leq 10^9$$$, $$$0 \leq t_i \leq 10^9$$$, $$$0 < |c_i| \leq 1000$$$) – the description of the $$$i$$$-th update.
It is guaranteed that the $$$x_i$$$ will be given in non-decreasing order.
After each update, print the maximum number of friendships that can be formed.
5 0 6 3 4 2 -5 7 4 -6 10 5 100 10 8 7
0 3 3 3 10
5 0 6 3 4 2 -5 7 4 -6 10 5 100 11 8 7
0 3 3 3 9
7 0 8 6 2 7 -2 3 1 -6 5 3 -8 7 3 -3 8 0 -2 8 2 1
0 0 6 6 6 6 7
4 0 0 -3 0 0 2 0 0 4 0 0 -10
0 2 3 6
In the first example, the number of friendships after each update can be optimized as follows:
Name |
---|