Game and Queries

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Alice and Bob are going to play a game. The rule of the game is as follows:

  • There are some monsters, each of which has a specified HP.
  • Alice and Bob take turns alternately, with Alice going first.
  • In Alice's turn, she chooses one of the monsters and increases its HP by 11.
  • In Bob's turn, he chooses one of the monsters and decreases its HP by 22. If the monster's HP becomes 00 or less, the monster disappears.
  • The game ends when kk monsters disappear.

Alice's objective is to finish the game as late as possible, while Bob's is as soon as possible.

Initially, there are no monsters. You have to process QQ queries of the following types:

  • Type 11: You are given two integers X_iX\_i and Y_iY\_i. After this query, the number of monsters whose HPs are X_iX\_i becomes Y_iY\_i.
  • Type 22: Given an integer K_iK\_i, calculate how many turns would Bob take if the game started with current monsters and k=K_ik=K\_i, assuming both players play optimally.

Note that the game doesn't happen in reality, and the monsters don't disappear.

입력

Input is given from Standard Input in the following format:

QQ

Description of the 1-st query

Description of the 2-nd query

\vdots

Description of the Q-th query

The description of each query is in one of the following formats:

Type 11: 11 X_iX\_i Y_iY\_i

Type 22: 22 K_iK\_i

출력

For each query of the type 22, print the answer in a line.

제한

  • 1Q3×1051 \leq Q \leq 3 \times 10^5
  • 1T_i21 \leq T\_i \leq 2
  • 1X_i1061 \leq X\_i \leq 10^6
  • 0Y_i1060 \leq Y\_i \leq 10^6
  • 1K_i(1 \leq K\_i \leq ( the number of current monsters ))
  • There is at least one query of the type 22
  • All values in input are integers.

힌트

After the 55-th query, there are 44 monsters whose HPs are 11 and 22 monsters whose HPs are 22.