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

建议使用的浏览器:

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

3679:Jubilation

题目描述
One of the key elements to hold a successful programming contest is maximizing the overall satisfaction degree of all participating teams. Although a team's satisfaction degree is influenced by many factors -- for example, whether this competition is well-organized, and sometimes the weather condition of the place where the competition is held - but among those factors, what usually influences a team's satisfaction degree most is the team's performance in the contest.

Since the performance factor is a matter which the organizing committee cannot control, ask you to simply estimate the overall satisfaction degree of all teams. In particular, through years of experience, the committee asks you to calculate the satisfaction degree of a team using the following estimation steps:

1. If this team has performed in the contest at least as well as it had expected, its satisfaction degree is 3; otherwise
2. If this team's performance is better than its last year's performance, its satisfaction degree is 2; otherwise its satisfaction degree is 1.

(For the sake of simplicity, both the performance of a team and a team's expectation are measured by its place on the rank list.)

This year's and last year's rank lists, along with the expectations of all teams are already given to you. (But the method which we used to find the expectations of the participating teams will remain a secret!) Can you calculate the total satisfaction degree of all teams by the above rules and the data you've been given?
输入解释
There are multiple test cases in the input file. Each test case starts with one integer N (3<=N<=1000) on a single line, the number of teams participating in the contest.

The second line of every test case consists of N numbers in the range [1...N] , the i -th number representing the ID of team with i -th place in this year's contest. Similarly, the third line of every test case describes the final rank list of last year's contest. You can assume there will be no ties in the rank lists given to you.

The last line of every test case consists of N numbers in the range [1...N] , the i -th number representing the expectation of the i -th team this year. There's a blank line between two successive test cases. A single line with N = 0 indicates the end of input file.
输出解释
For each test case, output one integer on a separate line, the overall satisfaction degree of all teams, in the format as indicated in the sample output.
输入样例
5 
5 4 1 3 2 
3 1 5 2 4 
3 5 1 1 2 

5 
5 4 1 3 2 
1 2 4 5 3 
5 3 3 5 1

0
输出样例
Case 1: 12 
Case 2: 12
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3679

最后修改于 2020-10-25T23:05:54+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)