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

建议使用的浏览器:

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

6008:Worried School

题目描述
You may already know that how the World Finals slots are distributed in EC sub-region. But you still need to keep reading the problem in case some rules are different.
There are totally G slots for EC sub-region. X slots will be distributed among five China regional sites and Y slots will be distributed to the EC-Final. Of course X and Y are non-negative integers and X + Y = G.
Here is how the X slots be distributed:

1. Slots are assigned to the Asia Regional sites from the first place, the second place, · · · , last place.
2. For schools having the same place across the sites, the slots will be given in the order of the number of “effective
teams” in the sites.
3. No school could be assigned a slot 2 times, which means the schools will be skipped if they already got a slot.

After X slots are distributed, the EC-Final ranklist from highest rank will be assigned Y slots for those schools that haven’t got a slot yet.
Now here comes a sad story, as X and Y are not announced until the end of the last regional contest of that year, even later!!!
Teachers from a school are worried about the whether they can advance to WF whatever the X and Y is. Let’s help them find out the results before the announcement of X and Y .
输入解释
The first line of the input gives the number of test cases, T. T test cases follow.
Each test case starts with a line consisting of 1 integer and 1 string, G representing the sum of X and Y and S representing the name of the worried school.
Next 5 lines each consists of 20 string representing the names of top 20 schools in each site. The sites are given in the order of the number of “effective teams” which means the first site has the largest number of “effective teams” and the last site has the smallest numebr of “effective teams”.
The last line consists of 20 strings representing the names of top 20 schools in EC-Final site. No school can appear more than once in each ranklist
输出解释
For each test case, output one line containing “Case #x: y”, where x is the test case number (starting from 1) and y is “ADVANCED!” if every non-negative value X, Y will advance the school. Otherwise, output the smallest value of Y that makes the school sad.
$\bullet$ 1 ≤ T ≤ 200.
$\bullet$ School names only consist of upper case characters ‘A’ - ‘Z’ and the length is at most 5.
$\bullet$ 1 ≤ G ≤ 20.
输入样例
1
10 IJU
UIV GEV LJTV UKV QLV TZTV AKOV TKUV
GAV DVIL TDBV ILVTU AKV VTUD IJU IEV
HVDBT YKUV ATUV TDOV
TKUV UIV GEV AKV AKOV GAV DOV TZTV
AVDD IEV LJTV CVQU HVDBT AKVU XIV TDVU
OVEU OVBB KMV OFV
QLV OCV TDVU COV EMVU TEV XIV
VFTUD OVBB OFV DVHC ISCTU VTUD OVEU DTV
HEVU TEOV TDV TDBV CKVU
CVBB IJU QLV LDDLQ TZTV GEV GAV KMV
OFV AVGF TXVTU VFTUD IEV OVEU OKV DVIL
TEV XIV TDVU TKUV
UIV DVIL VFTUD GEV ATUV AKV TZTV QLV
TIV OVEU TKUV UKV IEV OKV CVQU COV
OFOV CVBB TDVU IOV
UIV TKUV CVBB AKV TZTV VFTUD UKV GEV
QLV OVEU OVQU AKOV TDBV ATUV LDDLQ AKVU
GAV SVD TDVU UPOHK
输出样例
Case #1: 4
提示
For the first test case, the optimal solution is X = 6 and Y = 4, at this time the advanced schools were [UIV, TKUV, QLV, CVBB, GEV, OCV, AKV, TZTV, VFTUD, UKV].
来自杭电HDUOJ的附加信息
Recommend jiangzijing2015

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

题目来源 2016 CCPC-Final

源链接: HDU-6008

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

共提交 10

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