| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 518 人关注过本帖
标题:第31届ICPC北京赛区网络试题(I)
只看楼主 加入收藏
蓝色神话
Rank: 2
等 级:论坛游民
威 望:1
帖 子:404
专家分:24
注 册:2006-5-11
收藏
 问题点数:0 回复次数:0 
第31届ICPC北京赛区网络试题(I)
Lazy men's service(I)
Time Limit:10S Memory Limit:32768K
Description
There is a service station specially designed for lazy men in the world. Like other service stations, this station also has waiters and counters. However, because it is opened for lazy men, who are only willing to come to the nearest counter, and because the station lacks waiters, waiters always have to move among counters to provide service. What's more, if lazy men are not serviced in time, they will ask for troubles, which make waiters complaint. Luckily, these customers are so lazy that they leave as soon as they gain service, and it takes nearly no time for the consult process. So, waiters hardly do anything other than moving among counters.
The station has a website. Lazy men always visit the website to inquire their own service time and counter. Then, they come to counter when their service time comes. Every morning, manager of the station can get a list of today's visitors. The website only arranges one lazy man to consult at each moment. The website designs so good that waiters have enough time to move between any of the two counters during each of the two moments.
You are a new-hired manager. You are working to solve the employees' problems. As the internal paths among counters are complex, it takes different level of energy to move from any counter to the other counters. You find out that the complaint issue can be solved if waiters moved efficiently such that the total energy cost is minimized. So, you decide to reconstruct the website, arrange a certain waiter for each moment and calculate the minimized level of energy cost.
Input
Input contains several cases.
Input contains what happens to the service station in several days.
For each day, Line 1 contains three number, specifying there are n lazy men to service, m waiters on work and p open counters (1 <= n <= 200, 1 <= m <= 100, 1 <= p <= 100).
Each line between Line 2 and Line p+1 contains p integers. The j-th number of Line i+1 is ci,j, specifying the energy cost of waiters who move from counter i to counter j. ci,i=0, ci,j may not equal to cj,i(0 <= ci,j <= 105).
Line p+2 contains m integers. The i-th number si indicates the initial counter where waiter i is in (1 <= si <= p).
Line p+3 contains n integers. The i-th number di indicates the counter selected by the lazy man who comes on time i (1 <= di <= p).
The last line of input contains a zero.
Output
For each day, output minimized energy cost and n numbers, the i-th of which indicates the waiter's number who services the lazy man coming on time i.
Sample Input
3 2 4
0 1 5 6
2 0 100 100
100 100 0 100
100 100 100 0
1 2
1 3 4
3 2 4
0 1 5 6
2 0 100 100
100 100 0 100
100 100 100 0
1 2
1 3 4
0
Sample Output
Case 1:
13
2 1 2
Case 2:
13
2 1 2
搜索更多相关主题的帖子: 北京 网络 赛区 试题 ICPC 
2006-10-11 12:03
快速回复:第31届ICPC北京赛区网络试题(I)
数据加载中...
 
   



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

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