luogu#P7894. 『JROI-3』1÷0
『JROI-3』1÷0
Background
1÷0=梦恋
On a distant hill, you can see a scene as if the heavens and the earth are collapsing.
"——A report has come from the 'Design Entity'——Design successfully reproduced at power '72.8%'——Begin synchronization."
One female body of the Ex-Machina said this to Riku, then raised her hand.
"【Tenka】——Org.0000——'True Canon · Star-Slayer'——Please."
——What appeared in the void was something that looked like a small tower, a spear stuck into the ground.
What was just witnessed was a violent vortex that seemed to end the world.
Problem Description
Sora uses checkers to simulate the movement of the Ex-Machina in the "Holy War".
On an infinite number line, there are immovable checkers. Sora will ask: if you place one movable checker at a position, how many jumps can it make at most. Sora will ask many times, and each query is independent.
Let the coordinate of the -th immovable checker be .
The movement rules are as follows:
- This checker must be movable.
- If the checker is at and the target position is , then there must be exactly one checker between the two positions, and the distance from the middle checker to and must be equal.
Formally, it should satisfy:
$$\sum_{k=1}^n \left[x_k\in\left[b,a\right]\right]=1$$and .
- The problem setter is too kind (so you can only jump to the left).
Input Format
The first line contains two integers , as described.
The next line contains integers; the -th one is .
The next line contains numbers , meaning the position where the movable checker is placed.
Output Format
Output lines. Each line contains an integer. The -th line is the answer to the -th query.
3 3
3 5 8
4 6 7
1
2
0
Hint
Sample Explanation 1
$$\Huge\Box\Box\blacksquare{\color{red}{\Box}}\blacksquare{\color{red}{\Box}}{\color{red}{\Box}}\blacksquare\Box\Box$$The three red squares from left to right are the query positions.
- For the first query, it can jump step, from 4 to 2.
- For the second query, it can jump steps, from 6 to 4 to 2.
- For the third query, the checker cannot move left, because there is an immovable checker at the position with the same distance on the left.
For of the testdata, , , , .
| Subtask ID | Time Limit | Memory Limit | Special Limit | ||
|---|---|---|---|---|---|
| Subtask 0 (10 pts) | |||||
| Subtask 1 (30 pts) | |||||
| Subtask 2 (25 pts) | |||||
| Subtask 3 (25 pts) | |||||
| Subtask 4 (10 pts) | |||||
- Constraint : .
- Constraint : There are no more than indices that do not satisfy . For the remaining , it satisfies .
Translated by ChatGPT 5