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

建议使用的浏览器:

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

3138:ACM Team Selection

题目描述

The ACM-ICPC brings together the top student programmers from all over the world, and provides them with opportunities to develop critical skills which will give them a competitive edge when they launch careers in information technology areas. More than 5,600 teams from 84 countries had competed in regional contests last year. An ever larger number of teams – more than 7,000 teams from different countries worldwide – have registered in this year’s regional contests. However, due to the limited capacity of each site, only a small amount of the registered teams can be allowed to participate in the on-site contest. It is really hard for the contest organizers to determine which teams should be allowed to participate. One of the possible solutions is to hold a preliminary internet contest before the on-site competition. The following part describes a simplified version of rules for team selection:

Up to three teams from each school can participate in the on-site contest, depending on how many following conditions the school in question meets:

  1. A team from this school has solved at least M problems in the preliminary contest;
  2. Some of the teams from this school ranked top 20 in previous World Finals;
  3. This school has hosted a provincial contest this year.

Your task is to write a program to help the contest holders to calculate how many teams are allowed to participate in the on-site final contest.

输入解释

There are multiple test cases in the input file. Each test case starts with three integers S, T and M (1 ≤ S ≤ 100, 1 ≤ T ≤ 2000, 0 ≤ M ≤ 10), representing the number of schools, the number of teams participating in the preliminary contest, and the minimum number of problems which is required to be solved in order to enter the on-site competition, respectively.

Each of the following S lines consists of three integers Id, P and Q, (1 ≤ IdS, 0 ≤ P, Q ≤ 1), representing the Id of the school, whether this school satisfies condition b, and whether this school satisfies condition c.

The last part of each test case consists of T lines. There are two integers on each of the T lines, Sid and Tot (1 ≤ SidS, 0 ≤ Tot ≤ 10), meaning that a team from school Sid had solved Tot problems in the preliminary contest.

Two consecutive test cases are separated by a blank line. S = 0, T = 0, M = 0 indicates the end of input and should not be processed by your program.

输出解释

For each test case, print the total number of teams which are allowed to participate in the on-site competition on a separate line in the format as indicated in the sample output.

输入样例
5 8 6
5 0 1
4 0 0
1 0 0
3 1 1
2 1 1
2 6
3 3
2 9
5 7
4 8
3 6
2 8
1 6
5 8 6
3 0 1
5 1 1
2 0 1
1 1 1
4 1 0
5 7
2 5
4 5
5 5
3 3
5 6
2 0
4 7
0 0 0
输出样例
Case 1: 10
Case 2: 9

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

题目来源 Shanghai 2006

源链接: POJ-3138

最后修改于 2020-10-29T06:54:01+00:00 由爬虫自动更新

共提交 0

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