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

建议使用的浏览器:

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

3894:System Engineer

题目描述
Bob is a skilled system engineer. He is always facing challenging problems, and now he must solve a new one. He has to handle a set of servers with differing capabilities available to process job requests from persistent sources - jobs that need to be processed over a long or indefinite period of time. A sequence of persistent job requests arrives revealing a subset of servers capable of servicing their request. A job is processed on a single server and a server processes only one job. Bob has to schedule the maximum number of jobs on the servers. For example, if there are 2 jobs j1, j2 and 2 servers s1, s2, job j1 requiring the server s1, and job j2 requiring also the server s1. In this case Bob can schedule only one job. Can you help him?
In the general case there are n jobs numbered from 0 to n-1, n servers numbered from n to 2*n-1, and a sequence of job requests. The problem asks to find the maximum number of jobs that can be processed.
输入解释
The program input is at most 1 MB. Each data set in the file stands for a particular set of jobs. A data set starts with the number n (n <= 10000) of jobs, followed by the list of required servers for each job, in the format: jobnumber: (nr_servers) s1 ... snr_servers The program prints the maximum number of jobs that can be processed.
White spaces can occur freely in the input. The input data are correct and terminate with an end of file.
输出解释
For each set of data the program prints the result to the standard output from the beginning of a line.
输入样例
2 
0: (1) 2 
1: (1) 2 
1 
0: (1) 1
输出样例
1
1
提示
There are two data sets. In the first case, the number of jobs n is 2, numbered 0 and 1. The sequence of requests for job 0 is: 0: (1) 2, meaning that job 0 requires 1 sever, the server numbered 2. The sequence of requests for job 1 is: 1: (1) 2, meaning that job 1 requires 1 sever, the server numbered 2. The result for the data set is the length of the maximum number of scheduled jobs, 1.

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

源链接: POJ-3894

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

共提交 0

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