QOJ.ac

QOJ

时间限制: 4 s 内存限制: 256 MB 总分: 100

#11166. Beachgoers

统计

Every year, the beach by the Byte Sea enjoys great popularity among tourists from all over Byteotia. Currently, there are $n$ beachgoers—regulars—resting on it, and they are all lying on blankets right by the shore (everyone wants to be as close to the water as possible). Thus, we can describe the position of each blanket by its distance (in meters) from the beginning of the beach. The shore is $X$ meters long, so the position will be an integer from $0$ to $X$. For simplicity, we assume that the dimensions of the blankets are negligibly small. There are blankets at points $0$ and $X$. The regulars sunbathe on the beach at the same points all day long.

Byteotians value peace and quiet while relaxing. Each new beachgoer who arrives at the beach chooses a place to put their blanket such that it is right by the shore, but at the same time as far as possible from other beachgoers (thus, they maximize the distance to the nearest other blanket). If there is more than one such place, they choose the place closest to the beginning of the beach (where the best ice cream stand in the area is located). The positions of the new beachgoers' blankets do not have to be integers.

A bus with tourists has just arrived at the beach, and Baltazar is among them. Since he loves sitting in the back seat of the bus, he will be the last to leave the vehicle. Tell him where he should lay out his blanket, depending on the total number $k$ of tourists on the bus.

Input

The first line of the input contains three integers $n$, $X$, and $z$ ($2 \le n \le 10^6$, $1 \le X \le 10^9$, $1 \le z \le 10^5$) denoting the number of beachgoers, the length of the beach, and the number of queries.

The second line contains a sequence of $n$ integers $x_1, x_2, \dots, x_n$ ($0 = x_1 < x_2 < \dots < x_n = X$) denoting the positions of the beachgoers.

The following $z$ lines contain the queries; the $i$-th of these lines contains a single integer $k_i$ ($1 \le k_i \le 10^9$).

Output

You should output exactly $z$ lines containing the answers to the consecutive queries from the input. The $i$-th line should contain one irreducible fraction $p/q$ ($0 \le p/q \le X$ and $p, q$ should be positive integers) denoting the position where Baltazar should lay out his blanket if there were a total of $k_i$ tourists on the bus and they all lay out their blankets before Baltazar does.

Examples

Input 1

5 10 5
0 2 3 7 10
1
2
5
6
8

Output 1

5/1
17/2
6/1
31/4
1/2

Note

Explanation of the example: If the bus brought $k = 8$ tourists, the tourists, in the order they leave the bus, will lay out their blankets at points $5, 8 \frac{1}{2}, 1, 4, 6, 7 \frac{3}{4}, 9 \frac{1}{4}$ and $\frac{1}{2}$ (Baltazar). Note that the first, second, fifth, and sixth of the given points constitute the answers for the remaining queries from the example.

Evaluation

The test suite is divided into the following subtasks. Tests for each subtask consist of one or more separate test groups.

Subtask Conditions Points
1 $z = 1; k_1 \le 10^5$ 20
2 $n = 2$ 10
3 $n \le 10^4; z \le 5$ 20
4 $n \le 10^4$ 30
5 $z \le 10^3$ 10
6 no additional constraints 10

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.