#P16805. [蓝桥杯 2026 国 Python A] 算电协同
[蓝桥杯 2026 国 Python A] 算电协同
Problem Description
In , “computing-power and electricity coordination” was written into the government work report for the first time, and together with ultra-large-scale intelligent computing clusters, it was listed as a national-level new infrastructure project, supporting the construction of a nationwide integrated computing-power scheduling system. During the project implementation, national computing-power hub nodes need to manage a large number of computing units in real time.
Each computing unit has an energy-efficiency value in the form of a non-negative integer. To optimize energy scheduling, the scheduling system needs to count the number of pairs of units that satisfy the “coordination condition”. Define two computing units as a coordinated pair if and only if:
- ;
- $\text{Fib}(v_i + v_j) = \text{Fib}(v_i) + \text{Fib}(v_j)$.
Here, denotes the -th Fibonacci number. The Fibonacci sequence is defined as follows:
- ;
- ;
- For , .
Now, you need to maintain an initially empty pool of computing units and process operations:
- : Add computing units with energy-efficiency value .
- : Remove at most computing units with energy-efficiency value . If there are fewer than units with value , remove all of them.
- : Query how many coordinated pairs of units there are in total at the moment.
Please write a program to simulate the operation of this scheduling system and output the corresponding result for each query.
Input Format
The first line contains a positive integer , indicating the number of operations.
The next lines each describe one operation:
- : Add units with value .
- : Remove at most units with value .
- : Query the current total number of coordinated pairs.
Output Format
For each operation , output one line containing one integer, indicating the current total number of coordinated pairs.
5
1 2 0
1 3 1
3
2 4 0
3
7
0
Hint
Constraints and Notes
For of the testdata, , .
For all testdata, , , .
Translated by ChatGPT 5