Logo
(追記) (追記ここまで)

24715번 - EIP1559 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB128770.000%

문제

You are an avid Ethereum researcher. Recently Ethereum passed a resolution to change the gas rate of a transaction from a value $\mathit{gasPrice}$ to a pair $(\mathit{maxFee}, \mathit{maxPriorityFee})$. The exact gas price of a transaction is calculated by $\mathit{gasPrice}=\min(\mathit{maxFee},\mathit{maxPriorityFee}+\mathit{baseFee}),ドル while $\mathit{baseFee}$ is a parameter that can change over time.

You maintain a dynamic collection of transactions. At some moments, you want to know, for a specific $\mathit{baseFee},ドル what is the largest $\mathit{gasPrice}$ of a transaction in the collection.

Specifically, you need to maintain a collection of transactions that supports the following three operations:

  1. Add a transaction with the gas rate $(\mathit{maxFee}, \mathit{maxPriorityFee})$ to the collection.
  2. Remove a single transaction with the gas rate $(\mathit{maxFee}, \mathit{maxPriorityFee})$ from the collection. It is guaranteed that there is at least one transaction that satisfies the condition.
  3. For a specific $\mathit{baseFee},ドル find the maximum value of $\mathit{gasPrice}$ in the collection when the current base fee is $\mathit{baseFee}$. It is guaranteed that there is at least one transaction in the collection.

입력

The first line contains an integer $t$ (0ドル \leq t \leq 10^6$) representing the number of operations. For the following $t$ lines, the first integer $\mathit{type}$ on each line represents the type of the current operation.

If $\mathit{type}=1,ドル the next two integers are $\mathit{maxFee}$ and $\mathit{maxPriorityFee}$. You should add a transaction with gas rate $(\mathit{maxFee}, \mathit{maxPriorityFee})$ to the collection.

If $\mathit{type}=2,ドル the next two integers are $\mathit{maxFee}$ and $\mathit{maxPriorityFee}$. You should remove a single transaction with gas rate $(\mathit{maxFee}, \mathit{maxPriorityFee})$ from the collection.

If $\mathit{type}=3,ドル the next integer is $\mathit{baseFee}$. You should output the maximum value of $\mathit{gasPrice}$ in the collection when the current base fee is $\mathit{baseFee}$.

It is guaranteed that all the values of $\mathit{maxFee},ドル $\mathit{maxPriorityFee},ドル and $\mathit{baseFee}$ are integers in range $[0,10^6]$.

출력

For each operation with $\mathit{type}=3,ドル output a line with an integer representing the current largest $\mathit{gasPrice}$ when the current base fee is $\mathit{baseFee}$.

제한

예제 입력 1

9
1 200000 20000
1 150000 40000
1 120000 50000
1 130000 30000
3 80000
3 100000
3 140000
2 150000 40000
3 100000

예제 출력 1

120000
140000
160000
130000

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2022 > Day 6: ICPC Camp Day 1: PKU Contest I번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /