#P2838. 瓶子国的故事
瓶子国的故事
Description
We use the amount of water to represent a number.
- The capacity of a bottle is the maximum amount of water it can hold.
The king of Bottle Country believes bottles can do the following:
- : Create a new bottle whose capacity and current amount of water are both equal to the input number. Its index is .
- : Fill the bottle with index to its full capacity.
- : Empty the bottle with index .
- : Create a new bottle with capacity and no water in it. Its index is . Note that due to limited capacity, .
- : Create a new bottle whose capacity equals and which initially contains no water. Its index is .
- : Pour water from bottle into bottle until bottle becomes empty or bottle becomes full (note ).
- : Output the amount of water in bottle .
There is also an expensive operation:
- : Create a new bottle whose capacity equals . Its index is . Note that due to capacity limits, must not exceed . (Using this operation deducts points; see the scoring rules below.)
The king gives you these operations; you only need to output them, and the bottles will execute them for you!
The king of Bottle Country gives you several computational tasks. Just implement these tasks.
On the left are the data point IDs; on the right are the tasks:
- Given and , compute . ()
- Given and , compute . ()
- Given and , compute . ()
- Given and , output . ()
- Given , output the 32-bit binary representation of . (, for example, outputs $\verb!0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1!$)
- Given and , output . ()
- Given and , output . (, where denotes bitwise XOR)
- Given , output . ()
- Given and , output . ()
- Given and , output . (, and does not exceed )
The king will generate about groups of testdata to test your program and will score it based on the number of operations you use. See the scoring rules below.
(UPD: If you did not understand the problem, here is an additional explanation.)
Your program submitted to Luogu (C/C++/Pascal) must output a sequence of operations in the format similar to the sample output.
For example, for the first data point, after submission the checker on Luogu will randomly generate and as the inputs to the operation to test your operations.
For the local checker (see the Hint section for download), you can save your output operations to a file named a.txt. Then input a.txt on the first line. On the second line, input if playing manually, or input the specific data point ID if testing that point.
Input Format
A single line containing one integer representing the data point ID.
Output Format
Output a sequence of operations that satisfies the computational task.
233
// 仅作为参考,这里应该填数据编号
I
C 1
F 2
C 233333
T 1 3
T 2 3
O 3
(这个程序可以进行x+1!是不是很厉害啊!不过程序中并不能附加任何注释)
Hint
Please note you are submitting a program that outputs operations! (If you generate the answers and then delete the program and directly hardcode the outputs, your output might exceed limits.)
Inspired by NOI2016 “Wilderness Big Computation” (you probably knew that anyway).
For convenient local testing, here is a C++ local checker (note that its results may differ from Luogu’s; Luogu may be stricter):
If you need an executable, you can use Baidu Netdisk:
- http://pan.baidu.com/s/1o7HZ1GY Password:
kqhl.
Scoring Rules:
If your algorithm produces a wrong result (extra outputs also count), or a runtime error occurs (operations violate the rules, etc.), or the number of lines exceeds , or the lines are so many that the checker cannot finish testing groups within s, you receive points.
Otherwise, suppose the standard solution uses steps and your solution uses steps.
- If , your base score is points.
- If , your base score is points.
- If , your base score is points.
- If , your base score is points.
- If , your base score is points.
- If , your base score is points.
If you use the expensive operation, you will get (base score ) points.
Otherwise, you will receive the base score.
(In plain words: fewer steps → higher score; using the K operation deducts 4 points.)
(UPD2: Common checker error messages on Luogu)
too many lines:超过500w行(这个似乎还没有触发过)
WTF:就是操作的第一个字符串(I/T/K/F/E/C/M/O)长度大于1
(可能是由于上一个操作多跟了一个操作数?)
wrong operation:操作的第一个字符串长度为1但不是I/T/K/F/E/C/M/O。
expected *****:希望输入一个数/字符串却没有(可能是操作数多打/少打)
nothing to input:I操作数量大于输入的数数量
F/E/C/M/T/O/K wrong bottle:操作的瓶子编号不在[1,当前最大编号]范围内
C exceed [0,10^9]:字面意思
K exceed 10^9:字面意思
wa on test xxx:你在第xxx组随机数据狗带了
wa on extratest xxx:你在第xxx组人工数据(手打的)狗带了
Translated by ChatGPT 5
京公网安备 11011102002149号