| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 466 人关注过本帖
标题:第31届ICPC北京赛区网络试题(G,H)
只看楼主 加入收藏
蓝色神话
Rank: 2
等 级:论坛游民
威 望:1
帖 子:404
专家分:24
注 册:2006-5-11
收藏
 问题点数:0 回复次数:0 
第31届ICPC北京赛区网络试题(G,H)

Hati Massage(G)
Time Limit:10S Memory Limit:65536K
Description
Hati is a professional massagist. One day, Hati receives massage requests from n customers. The ith customer (1<=i<=n) requests massage service during the period from time ai to time bi (inclusive), and is willing to pay Hati ci. As different customers' requested periods may conflict, Hati can only select to accept some requests.
What baffles Hati is that one in n customers is possible to break appointment. However, he doesn't know at first which customer will do so, until the customer's requested period begins. Hati wants to make a decision, such that his earning can be maximized in the worst case.
At first, Hati selects to accept some customers' requests. He makes a list of those accepted requests, and massage according to the list. Once Hati finds a customer breaks appointment, Hati can affirm no other customers will do so, and he can rearrange the following requests. If ith customer breaks appointment, Hati can rearrange and begin to accept other customers' requests on time ai.
You need to help Hati to make this initial customer list, and calculate his earning in the worst case under such a list.
Input
Input contains several cases.
The first line of each case is n (1<=n<=10000). The i-th line of the following n lines contains ai, bi and ci(1<=ai<=bi<=10^6, 1<=ci<=10^5).
The last line of input is a zero.
Input contains 20 cases at most.
Output
For each case, output Hati's earning in the worst case, as well as his initial customer list in the format:
m k1 k2 ... km
This indicates that Hati initially decides to accept m customers, whose serial numbers are ranked in time order.
Sample Input
4
1 3 200
4 5 100
4 5 50
2 6 400
4
1 3 200
3 5 100
4 5 50
6 7 100
0
Sample Output
Case #1:
250
2 1 2
Case #2:
200
2 1 2
Instruction of Sample Case #1
Hati initially selects Customer 1 and Customer 2. Under such selection, there are three possibilities:
(a) No customer breaks appointment. Hati earns 300.
(b) Customer 1 breaks appointment. Hati re-selects Customer 4 and earns 400.
(c) Customer 2 breaks appointment. Hati re-selects Customer 3 and earns 250.
So, his earning in the worst case is 250.

A difficult problem(H)
Time Limit:10S Memory Limit:32768K
Description
For a sequence {A1, A2, ..., An} whose elements range from 1 to n, and a 1-n permutation {B1,B2,??,Bn}, sequence {C1,C2,??,Cn} is calculated by the following formula:
Ci=BABi-1
Bi-1 indicates the position of number i in sequence B. For example, n=3, B is {3,1,2}, then B3-1 =1 and B1-1 =2.
Given sequence {Ci}, how many {Ai} can obtain {Ci} by selecting proper {Bi}?
For example, C={1,2,3,4,5}, if and only if A={1,2,3,4,5}, C can be obtained by any possible {Bi}. In another word, whatever Bi is, if A={1,2,3,4,5}, you will obtain C={1,2,3,4,5}.
Input
Input contains several cases.
For each case, the first line is n (1 <= n <= 50), followed by a line of C1, C2, ..., Cn.
The last line of input contains a zero.
Output
For each case, output how many {Ai} can obtain {Ci} by selecting proper {Bi}.
Sample Input
5
1 2 3 4 5
5
2 2 2 2 2
5
3 2 5 2 2
0
Sample Output
Case 1:
1
Case 2:
5
Case 3:
120

搜索更多相关主题的帖子: 北京 网络 赛区 试题 ICPC 
2006-10-11 12:03
快速回复:第31届ICPC北京赛区网络试题(G,H)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014961 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved