13218 - BBPoints   

Description

There are  black points on coordinate plane. The -th black point(they're numbered in 1-based) is on  in the beginning.

Then  events happens. There are two types of event:

  1. y-coordinates of the -th point increase by 
  2. a blue point appears on  and it will keep moving right until it reaches . When it touches some black point, that black point will move down for "the distance which the blue point has moved". The blue point will vanish when it touches a black point or stop moving.

In the end, output y-coordinates of all the black points.

Hint

If you use std::set to store elements, you can use its member function std::set::lower_bound to find the iterator of the least element which is greater than or equal to the element you pass. The time complexity of std::set::lower_bound is  where  is the number of elements in that std::set. Do not use std::lower_bound on std::set.

You can refer to the following code.

set<int> s;

/* insert some elements into s */

int x = 5;
set<int>::iterator it;

/* (1) good */
it = s.lower_bound(x);

/* (2) bad */
it = lower_bound(s.begin(), s.end(), x);

Input

The first line contains two integers  and   – the number of black points and the number of events.

Then  lines follow. The -th line contains an integer  – the type of the -th event. If  is equal to 1, then two integers  and  follow. Otherwise three integers  and  follow.

 

It's guaranteed that:

  • The 1st testcase must be identical to the Sample below
  • For the first 5 testcases:  and  y-coordinate of any black point  always holds
  • For the first 7 testcases:  y-coordinate of any black point  always holds

Output

After the  events, output y-coordinates of all the black points and print a newline('\n') character.

Sample Input  Download

Sample Output  Download

Tags




Discuss