1680. The First Nonqualifying


原文链接: http://acm.timus.ru/problem.aspx?space=1&num=1680


背景:

Ural 1999年取得了第10. 距离进入决赛 相差6分钟时间惩罚.
2006年 资格最后一名和无资格的第一名相差4分钟. 

地区有q个名额代表参赛.  根据规则, 来自于相同大学的两个代表队不能同时进入决赛. 
如果出现情况, 两队中的成绩差者被淘汰. 
成绩排名第q+1. 称作 第一名无资格. 如果这一地区再增加一个名额, 它能进入决赛. 


y year 
n  teams  <=201
q 3-12


接下来n行 大学名, 成绩
求这只 "第一名无资格"


其实是统计前q名学校不重的元素,  在此基础输出第q+1. 











1680. The First Nonqualifying

Time limit: 0.5 second
Memory limit: 64 MB
Any participant of an ACM ICPC Regional contest knows that it is very annoying to take the place that is the first nonqualifying for the World Finals. It often happens that a team falls very short of getting into the Finals.
For example, in 1999 a team of the Ural State University took the tenth place at the Northeastern European Regional Contest, and only 6 minutes of penalty time kept it from getting into the Finals. The last qualifying ninth place was then taken by a team of the St. Petersburg Institute of Fine Mechanics and Optics. In 2006 the distance between the last qualifying and the first nonqualifying places was as small as 4 minutes of penalty time. However, between teams of the Kazakh National University and the St. Petersburg Polytechnical University there was the third team of the Saratov State University, which could not go to the Finals because the second team of the same university had 2 more solved problems.
The Northeastern European Region, which holds Regional contests in which all Russian teams take part, is given every year some quota  q for representing this region in the World Finals. According to the ACM ICPC rules, no two teams of the same university may take part in the Finals. That is why, when it is decided who goes to the Finals, any team that has worse results than some other team of the same university is excluded from the protocol. The ( q + 1)th place in the resulting list is called the first nonqualifying. If the regional quota were increased by one place, then the team that took that place would get into the Finals.

Input

The first line contains the year  y when a Northeastern European Regional Contest was held (an integer from 1996 to 2008), the number of participating teams  n ≤ 201, and the quota  q for the World Finals (an integer from 3 to 12). The numbers are separated with a space. In the following  n lines you are given the resulting protocol in the form of a list of the names of teams in the order of places they took at the contest. The name of each team consists of the name of its university and the number of the team separated from the name of the university by a space and symbol '#'. If a university was presented by only one team, then its name may consists of the name of the university only. The names of universities consist of English letters, spaces, symbols '.', '-', and '&'; they are no longer than 36 symbols. The names of two universities can't differ by the case of the letters only. The number of a team is an integer from 1 to 8.

Output

Output the name of the team that took the first nonqualifying place at this semi-final. It is guaranteed that such a team exists.

Sample

input output
1999 10 6
St Petersburg SU #1
Belarusian SU #1
Moscow SU #4
Southern Ural SU
Moscow SU #1
Novosibirsk SU #1
St Petersburg SU #3
Belarusian SU #3
St Petersburg IFMO #1
Ural SU #3
Ural SU #3
Problem Author: Dmitry Ivankov (prepared by Alexander Ipatov)
Problem Source: USU Open Personal Contest 2009 (February 28, 2009)
Tags: none  










# 1680
y, n , q = gets.chomp!.split(" ").map(&:to_i)
daiding=[] ; h = {} ; pmark = 0 ; input=[]
1.upto(n).each {|k|
    line = gets.chomp!
    univ, mingci = line.split("#")
   if  mingci.nil? or !h.keys.include? univ
         daiding << line  ;  pmark += 1;       h[univ] = pmark; 
   end
}   


puts daiding[q]



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值