English · Original
Chinese · Translation
Formal · Original
One department of some software company has $n$ servers of different specifications. Servers are indexed with consecutive integers from $1$ to $n$. Suppose that the specifications of the $j$\-th server may be expressed with a single integer number $c_j$ of artificial resource units.
In order for production to work, it is needed to deploy two services $S_1$ and $S_2$ to process incoming requests using the servers of the department. Processing of incoming requests of service $S_i$ takes $x_i$ resource units.
The described situation happens in an advanced company, that is why each service may be deployed using not only one server, but several servers simultaneously. If service $S_i$ is deployed using $k_i$ servers, then the load is divided equally between these servers and each server requires only $x_i / k_i$ (that may be a fractional number) resource units.
Each server may be left unused at all, or be used for deploying exactly one of the services (but not for two of them simultaneously). The service should not use more resources than the server provides.
Determine if it is possible to deploy both services using the given servers, and if yes, determine which servers should be used for deploying each of the services.
## Input
The first line contains three integers $n$, $x_1$, $x_2$ ($2 \leq n \leq 300\,000$, $1 \leq x_1, x_2 \leq 10^9$) — the number of servers that the department may use, and resource units requirements for each of the services.
The second line contains $n$ space-separated integers $c_1, c_2, \ldots, c_n$ ($1 \leq c_i \leq 10^9$) — the number of resource units provided by each of the servers.
## Output
If it is impossible to deploy both services using the given servers, print the only word "_No_" (without the quotes).
Otherwise print the word "_Yes_" (without the quotes).
In the second line print two integers $k_1$ and $k_2$ ($1 \leq k_1, k_2 \leq n$) — the number of servers used for each of the services.
In the third line print $k_1$ integers, the indices of the servers that will be used for the first service.
In the fourth line print $k_2$ integers, the indices of the servers that will be used for the second service.
No index may appear twice among the indices you print in the last two lines. If there are several possible answers, it is allowed to print any of them.
[samples]
## Note
In the first sample test each of the servers 1, 2 and 6 will will provide $8 / 3 = 2.(6)$ resource units and each of the servers 5, 4 will provide $16 / 2 = 8$ resource units.
In the second sample test the first server will provide $20$ resource units and each of the remaining servers will provide $32 / 3 = 10.(6)$ resource units.
某个软件公司的某个部门拥有 $n$ 台不同配置的服务器。服务器的编号为从 $1$ 到 $n$ 的连续整数。假设第 $j$ 台服务器的配置可以用一个整数 $c_j$(单位为人工资源单位)表示。
为了使生产正常运行,需要部署两个服务 $S_1$ 和 $S_2$ 来使用部门的服务器处理传入请求。处理服务 $S_i$ 的传入请求需要 $x_i$ 个资源单位。
由于该公司处于先进水平,每个服务不仅可以使用单台服务器部署,还可以同时使用多台服务器。如果服务 $S_i$ 使用 $k_i$ 台服务器部署,则负载将平均分配给这些服务器,每台服务器仅需提供 $x_i \/ k_i$(可能为分数)个资源单位。
每台服务器可以完全不使用,或者仅用于部署其中一个服务(不能同时用于两个服务)。服务所使用的资源不得超过服务器提供的资源。
请判断是否可以使用给定的服务器部署这两个服务;如果可以,请确定每项服务应使用哪些服务器。
第一行包含三个整数 $n$, $x_1$, $x_2$($2 lt.eq n lt.eq 300 thin 000$,$1 lt.eq x_1, x_2 lt.eq 10^9$)——部门可使用的服务器数量,以及每个服务所需的资源单位数。
第二行包含 $n$ 个用空格分隔的整数 $c_1, c_2, dots.h, c_n$($1 lt.eq c_i lt.eq 10^9$)——每台服务器提供的资源单位数。
如果无法使用给定服务器部署两个服务,请仅输出单词 "_No_"(不含引号)。
否则,请输出单词 "_Yes_"(不含引号)。
第二行输出两个整数 $k_1$ 和 $k_2$($1 lt.eq k_1, k_2 lt.eq n$)——分别用于两个服务的服务器数量。
第三行输出 $k_1$ 个整数,表示用于第一个服务的服务器编号。
第四行输出 $k_2$ 个整数,表示用于第二个服务的服务器编号。
最后两行中输出的编号不得重复。如果存在多个可行答案,允许输出其中任意一个。
在第一个样例中,服务器 1、2 和 6 各提供 $8 \/ 3 = 2. (6)$ 个资源单位,服务器 5 和 4 各提供 $16 \/ 2 = 8$ 个资源单位。
在第二个样例中,第一台服务器提供 $20$ 个资源单位,其余每台服务器提供 $32 \/ 3 = 10. (6)$ 个资源单位。
## Input
第一行包含三个整数 $n$, $x_1$, $x_2$($2 lt.eq n lt.eq 300 thin 000$,$1 lt.eq x_1, x_2 lt.eq 10^9$)——部门可使用的服务器数量,以及每个服务所需的资源单位数。第二行包含 $n$ 个用空格分隔的整数 $c_1, c_2, dots.h, c_n$($1 lt.eq c_i lt.eq 10^9$)——每台服务器提供的资源单位数。
## Output
如果无法使用给定服务器部署两个服务,请仅输出单词 "_No_"(不含引号)。否则请输出单词 "_Yes_"(不含引号)。第二行输出两个整数 $k_1$ 和 $k_2$($1 lt.eq k_1, k_2 lt.eq n$)——分别用于两个服务的服务器数量。第三行输出 $k_1$ 个整数,表示用于第一个服务的服务器编号。第四行输出 $k_2$ 个整数,表示用于第二个服务的服务器编号。最后两行中输出的编号不得重复。如果存在多个可行答案,允许输出其中任意一个。
[samples]
## Note
在第一个样例中,服务器 1、2 和 6 各提供 $8 \/ 3 = 2. (6)$ 个资源单位,服务器 5 和 4 各提供 $16 \/ 2 = 8$ 个资源单位。在第二个样例中,第一台服务器提供 $20$ 个资源单位,其余每台服务器提供 $32 \/ 3 = 10. (6)$ 个资源单位。
**Definitions**
Let $ n \in \mathbb{Z} $ be the number of servers.
Let $ x_1, x_2 \in \mathbb{Z}^+ $ be the total resource requirements for services $ S_1 $ and $ S_2 $.
Let $ C = (c_1, c_2, \dots, c_n) \in \mathbb{Z}^n $ be the resource capacities of the servers, indexed from 1 to $ n $.
**Constraints**
1. $ 2 \leq n \leq 300{,}000 $
2. $ 1 \leq x_1, x_2 \leq 10^9 $
3. $ 1 \leq c_i \leq 10^9 $ for all $ i \in \{1, \dots, n\} $
**Objective**
Determine whether there exist disjoint non-empty subsets $ I, J \subseteq \{1, \dots, n\} $, with $ I \cap J = \emptyset $, $ |I| = k_1 \geq 1 $, $ |J| = k_2 \geq 1 $, such that:
$$
\frac{x_1}{k_1} \leq \min_{i \in I} c_i \quad \text{and} \quad \frac{x_2}{k_2} \leq \min_{j \in J} c_j
$$
If such subsets exist, output any valid assignment of server indices to $ I $ and $ J $. Otherwise, output "No".
API Response (JSON)
{
"problem": {
"name": "D. Resource Distribution",
"description": {
"content": "One department of some software company has $n$ servers of different specifications. Servers are indexed with consecutive integers from $1$ to $n$. Suppose that the specifications of the $j$\\-th serve",
"description_type": "Markdown"
},
"platform": "Codeforces",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "CF967D"
},
"statements": [
{
"statement_type": "Markdown",
"content": "One department of some software company has $n$ servers of different specifications. Servers are indexed with consecutive integers from $1$ to $n$. Suppose that the specifications of the $j$\\-th serve...",
"is_translate": false,
"language": "English"
},
{
"statement_type": "Markdown",
"content": "某个软件公司的某个部门拥有 $n$ 台不同配置的服务器。服务器的编号为从 $1$ 到 $n$ 的连续整数。假设第 $j$ 台服务器的配置可以用一个整数 $c_j$(单位为人工资源单位)表示。\n\n为了使生产正常运行,需要部署两个服务 $S_1$ 和 $S_2$ 来使用部门的服务器处理传入请求。处理服务 $S_i$ 的传入请求需要 $x_i$ 个资源单位。\n\n由于该公司处于先进水平,每个服务不仅可以使...",
"is_translate": true,
"language": "Chinese"
},
{
"statement_type": "Markdown",
"content": "**Definitions** \nLet $ n \\in \\mathbb{Z} $ be the number of servers. \nLet $ x_1, x_2 \\in \\mathbb{Z}^+ $ be the total resource requirements for services $ S_1 $ and $ S_2 $. \nLet $ C = (c_1, c_2, \\do...",
"is_translate": false,
"language": "Formal"
}
]
}