#P9155. 「GLR-R4」小满
「GLR-R4」小满
Description
Playing badminton on a wild court, on a campus with a good ecosystem, often runs into accidents—
"Tianyi! Why is the shuttlecock stuck in the tree again!"
Just as A Ling saw, their only remaining poor shuttlecock was swung by Tianyi onto the tree with the strength she uses to eat buns. To avoid the awkwardness of borrowing someone else’s volleyball or basketball to hit the tree, A Ling specially prepared a folding pole this time.
The folding pole is initially fully retracted, and we consider its length to be . Fully extending the folding pole takes steps, and each step is one of the following two cases:
-
Unfold the folding joint at the end of the pole. This operation has no extra parameters. After the operation, , i.e. the pole’s length becomes twice the original.
-
Extend the telescopic joint at the end of the pole. This operation provides an additional variable parameter . After the operation, , i.e. the pole’s length increases by .
The height of the shuttlecock in the tree, the final height of the pole, and Tianyi’s bun-eating strength may all be huge, so A Ling needs you to help compute the final length of the pole. You need to answer, after the operations are completed in order, the binary representation of .
Input Format
The first line contains an integer , indicating the number of test cases you need to process.
For each test case:
-
The first line contains an integer , indicating the number of operations to be performed.
-
The next lines each have the format
1or2 d, describing the two types of operations respectively. The integer is given in decimal.
Output Format
For each test case, output the binary representation of the final . Your answer should not contain extra leading zeros.
2
2
1
2 0
5
1
2 1
2 2
1
2 6
0
1100
Hint
Explanation of Sample #1
For the first test case: the change process of is , and .
For the second test case: the change process of is $0 \rightarrow 0 \rightarrow 1 \rightarrow 3 \rightarrow 6 \rightarrow 12$, and .
Constraints
For of the data, , , .
For different subtasks, the constraints are as follows:
| Subtask ID | Special Property | Subtask Score | |
|---|---|---|---|
| None | |||
| Yes | |||
| None | |||
- Special Property: only the second type of operation exists.
Translated by ChatGPT 5
京公网安备 11011102002149号