当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3759:Simple Distributed computing system

Special Judge 特殊评判
题目描述

Since Jack did a fantastic job on the simple distributed storage system, his mentor pushes him into another project. One scenario of the project is that, given a set of machines and a set of Web applications with CPU demands, a placement controller should decide which server should be used for each application and how to deploy the instances of those applications.

We assume that there are n applications and m servers. Some instances for the applications are already set up on the servers. However, each server runs different set of instances, and their CPU capacity are also distinct. For instance, server A runs two instances for application X and Y, while server B runs two instances for application Y and Z. So server A can handle some requests for application X and Y, and server B can run some requests for application Y and Z. To simplify our problem, we assume that the CPU capacity and CPU requirement can be represented by integer.

A server is fully utilized if its residual CPU capacity is zero. An application instance is "fully utilized” if it runs on a fully utilized server, otherwise it is called "underutilized”. However, an instance can be "completely idle" if it has no load. A placement scheme is "efficient” as long as for each application, there is at most one instance of this application on the status of "underutilized” but not "completely idle".

Your task is to write a placement controller program to make an "efficient” assignment and maximize the total satisfied CPU demand of all the applications.

An application can be run on several instances, and those instances mutually satisfy the CPU requirement of that application. All the instances' CPU load on one server cannot exceed the CPU capacity of that server.

输入解释

The first line of input file contains two integers n and m(n,m ≤ 200), representing the number of applications and the number of servers.

The second line contains n integers, representing the required CPU demand (≤ 1000)for each application. The application is numbered from 0 to n-1.

The following m lines describe the details of each server. In the ith line, the first integer represents CPU capacity of this server( ≤ 10000), and the second integer ki represents the number of instances running on it. Following is ki ( ≤ n)integers, ai,0, ai,1,…,ai,ki, representing the running instances for application ai,0, application ai,1,…, application ai,ki.

输出解释

The first line of the output file is an integer representing the maximum satisfied demand.

The following m lines contain the details of your solution. The ith line contains ki integers, representing how many CPU load put on the instances running on ith server. The order should be exactly the same as the input file.

输入样例
3 2
10 20 15
15 2 1 0
15 2 1 2
输出样例
30
15 0
0 15
提示
In the sample case, for the first server, instance for application 1 occupies the whole CPU (15 unit) and instance for application 0 is completed idle. For the second server, instance for application 2 is fully utilized while instance for application 1 is completed idle.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3759

最后修改于 2020-10-29T07:10:43+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536