CF925B.Resource Distribution

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

One department of some software company has nn servers of different specifications. Servers are indexed with consecutive integers from 11 to nn. Suppose that the specifications of the jj-th server may be expressed with a single integer number cjc_j of artificial resource units.

In order for production to work, it is needed to deploy two services S1S_1 and S2S_2 to process incoming requests using the servers of the department. Processing of incoming requests of service SiS_i takes xix_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 SiS_i is deployed using kik_i servers, then the load is divided equally between these servers and each server requires only xi/kix_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.

某软件公司的某个部门拥有 nn 台规格各不相同的服务器。服务器按连续整数编号,从 11 到 nn。假设第 jj 台服务器的规格可用一个整数 cjc_j(单位为人工资源单位)来表示。

为保障生产运行,需在该部门的服务器上部署两项服务 S1S_1 和 S2S_2,以处理传入的请求。服务 SiS_i 处理每个传入请求需消耗 xix_i 个资源单位。

由于这是一家技术先进的公司,因此每项服务不仅可部署于单台服务器上,也可同时部署于多台服务器上。若服务 SiS_i 部署于 kik_i 台服务器上,则负载将在这 kik_i 台服务器间平均分配,每台服务器仅需承担 xi/kix_i / k_i(该值可以是分数)个资源单位。

每台服务器可完全闲置,或仅用于部署其中一项服务(不可同时部署两项服务)。且任何服务器所承担的资源需求不得超过其自身所提供的资源量 cjc_j。

请判断:是否能利用给定的服务器成功部署这两项服务?若可以,请指出每项服务应分别部署在哪些服务器上。

输入格式

The first line contains three integers nn, x1x_1, x2x_2 (2≤n≤300 0002 \leq n \leq 300\,000, 1≤x1,x2≤1091 \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 nn space-separated integers c1,c2,…,cnc_1, c_2, \ldots, c_n (1≤ci≤1091 \leq c_i \leq 10^9) — the number of resource units provided by each of the servers.

第一行包含三个整数 nn、x1x_1、x2x_2(2≤n≤300 0002 \leq n \leq 300\,000,1≤x1,x2≤1091 \leq x_1, x_2 \leq 10^9)—— 分别表示该部门可使用的服务器数量,以及两项服务各自所需的资源单位数。

第二行包含 nn 个用空格分隔的整数 c1,c2,…,cnc_1, c_2, \ldots, c_n(1≤ci≤1091 \leq c_i \leq 10^9)—— 表示每台服务器所能提供的资源单位数。

输出格式

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 k1k_1 and k2k_2 (1≤k1,k2≤n1 \leq k_1, k_2 \leq n) — the number of servers used for each of the services.

In the third line print k1k_1 integers, the indices of the servers that will be used for the first service.

In the fourth line print k2k_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.

如果无法使用给定的服务器同时部署这两个服务,则仅输出单词“No”(不带引号)。

否则输出单词“Yes”(不带引号)。

第二行输出两个整数 k1k_1 和 k2k_2(1≤k1,k2≤n1 \leq k_1, k_2 \leq n)—— 分别表示用于两个服务的服务器数量。

第三行输出 k1k_1 个整数,表示将用于第一个服务的服务器的索引。

第四行输出 k2k_2 个整数,表示将用于第二个服务的服务器的索引。

最后两行中输出的所有索引互不相同。若存在多种可行解,输出任意一种即可。

输入输出样例

  • 输入#1

    6 8 16
    3 5 2 9 8 7

    输出#1

    Yes
    3 2
    1 2 6
    5 4
  • 输入#2

    4 20 32
    21 11 11 12

    输出#2

    Yes
    1 3
    1
    2 3 4
  • 输入#3

    4 11 32
    5 5 16 16

    输出#3

    No
  • 输入#4

    5 12 20
    7 8 4 11 9

    输出#4

    No

说明/提示

In the first sample test each of the servers 1, 2 and 6 will will provide 8/3=2.(6)8 / 3 = 2.(6) resource units and each of the servers 5, 4 will provide 16/2=816 / 2 = 8 resource units.

In the second sample test the first server will provide 2020 resource units and each of the remaining servers will provide 32/3=10.(6)32 / 3 = 10.(6) resource units.

在第一个样例测试中,服务器 1、2 和 6 各提供 8/3=2.(6)8 / 3 = 2.(6) 个资源单位,服务器 5 和 4 各提供 16/2=816 / 2 = 8 个资源单位。

在第二个样例测试中,第一台服务器提供 2020 个资源单位,其余每台服务器各提供 32/3=10.(6)32 / 3 = 10.(6) 个资源单位。

输入解题思路,AI测评打分。不知道怎么写?

首页