logo AlgoBeat OnlineJudge
登录 注册

#208814. [ICPC 2022 Xi'an R] Streets

内存限制:512 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

You are given vertical lines with x-coordinates and weights and horizontal lines with y-coordinates and weights .

Call a rectangle good if and only if all of its four edges lie on the given lines. On this basis, define the cost of a good rectangle as the sum of the costs of its four segments. The cost of a segment is the product of its length and the weight of the line it belongs.

Find the maximum area of good rectangles with cost no more than . Note that the length and the width of the rectangle can be zero, so the answer always exists.

You need to answer queries with different .

输入格式

The first line contains three integers , () and ().

The second line contains integers ().

The third line contains integers ().

The fourth line contains integers ().

The fifth line contains integers ().

Each of the next lines contains a single integer (), representing a query.

输出格式

For each query, output one line representing the answer.

样例

样例输入 1

3 4 20
1 3 4
3 1 2
1 3 4 7
4 2 1 2
1
5
6
7
9
10
11
12
15
16
17
22
23
28
30
35
43
47
49
57

样例输出 1

0
0
1
1
1
2
2
3
3
4
4
6
6
9
9
12
12
12
18
18

数据范围与提示

Source: The 2022 ICPC Asia Xi'an Regional Contest Problem K.

Author: Alex_Wei.