Rank List

    这是我第二次做codeforces的比赛,成绩没第一次好,主要原因还是那个万年不变的原因——看不懂题意。报告一下时间2012年3、24 1:12。先不唠叨,很有必要感谢我的上铺兄弟zhifa,他的英语水平很ok,就让他帮我看题,我太心急了,在没有了解题意的情况下就敲代码,结果呢?结果悲剧了!就又一次读题,终于明白了题意,再次感谢他!(童鞋们,还是学英语吧!谁让祖国不强大,啥时比赛都有中英对照时,哈哈。又幻想了.....)
       读题注意以下几点:
      如果解题数目和所用时间都相等则他们就共同排名在(y+1,y+2,..y+x),y是比他们成绩好的,x是同名次的人数
       我的思路先排序,再比较,这个方法很笨拙,先贴上,改天看看大神的
A. Rank List
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.

You know the rules of comparing the results of two given teams very well. Let's say that teama solvedpa problems with total penalty timeta and teamb solvedpb problems with total penalty timetb. Teama gets a higher place than team b in the end, if it either solved more problems on the contest, or solved the same number of problems but in less total time. In other words, teama gets a higher place than team b in the final results' table if eitherpa > pb, orpa = pb andta < tb.

It is considered that the teams that solve the same number of problems with the same penalty time share all corresponding places. More formally, let's say there is a group ofx teams that solved the same number of problems with the same penalty time. Let's also say thaty teams performed better than the teams from this group. In this case all teams from the group share placesy + 1,y + 2,...,y + x. The teams that performed worse than the teams from this group, get their places in the results table starting from they + x + 1-th place.

Your task is to count what number of teams from the given list shared the k-th place.

<P< p><P< p>
Input
<P< p>

The first line contains two integers n andk (1 ≤ k ≤ n ≤ 50). Thenn lines contain the description of the teams: thei-th line contains two integerspi andti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces.

<P< p><P< p>
Output
<P< p>

In the only line print the sought number of teams that got the k-th place in the final results' table.

<P< p><P< p>
Sample test(s)
<P< p><P< p>
Input
7 2
4 10
4 10
4 10
3 20
2 1
2 1
1 10
Output
3
Input
5 4
3 1
3 1
5 3
3 1
3 1
Output
4
<P< p><P< p>
Note
<P< p>

The final results' table for the first sample is:

  • 1-3 places — 4 solved problems, the penalty time equals 10
  • 4 place — 3 solved problems, the penalty time equals 20
  • 5-6 places — 2 solved problems, the penalty time equals 1
  • 7 place — 1 solved problem, the penalty time equals 10

The table shows that the second place is shared by the teams that solved 4 problems with penalty time 10. There are 3 such teams.

The final table for the second sample is:

  • 1 place — 5 solved problems, the penalty time equals 3
  • 2-5 places — 3 solved problems, the penalty time equals 1

The table shows that the fourth place is shared by the teams that solved 3 problems with penalty time 1. There are 4 such teams.

这是pony神的程序,第二天才发现我的没过

#include<stdio.h>
struct node
{
	int score;
	int time;
}p[1000];
int main()
{
	int n,k;
	int t;
	struct node q;
	scanf("%d%d",&n,&k);
	int i,j;
	for(i=0;i<n;i++)
		scanf("%d%d",&p[i].score,&p[i].time);
	for(i=0;i<n-1;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(p[i].score<p[j].score)
			{q=p[i];p[i]=p[j];p[j]=q;}
			else if(p[i].score==p[j].score)
			{if(p[i].time>p[j].time)
			{q=p[i];p[i]=p[j];p[j]=q;}
			}
		}
	}
	int s=0;
	for(i=0;i<n;i++)
		if(p[i].score==p[k-1].score&&p[i].time==p[k-1].time)
			s++;
	printf("%d\n",s);
	return 0;
}
--------------------------------------------------------------------------------



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ACM/ICPC比赛成绩会按照一定的规则计算各位参赛者的名次并实时显示排行榜,计算规则主要参考解题的数量及罚时,解题数量越多,罚时越少,则排名越高。 解题数量很容易计算,只需考察比赛中标记为“Accepted”的题数即可。罚时计算则相对复杂,对于提交到竞赛系统中的每道题目,系统会给出一个罚时,为从比赛开始到该题提交的代码第一次被“Accepted”的时间。请注意,只是第一次“Accepted”。对于“Accepted”之前的每次提交,都有20分钟的罚时,但如果该题目最终未解出,则不计罚时。 先在有一个比赛的题目通过情况记录,请生成该比赛的排行榜。 示例输入: 2008-04-25 18:00:00 2008-04-25 23:30:00 1000 1001 1002 1003 1004 38 602203621 1002 Accepted 756K 30MS C++ 2008-04-25 18:04:59 37 liheyuan 1002 Wrong_Answer 768K 10MS C++ 2008-04-25 18:28:05 36 ftest 1000 Accepted 888K 10MS C++ 2008-04-25 21:30:32 35 ftest 1000 Accepted 904K 10MS C++ 2008-04-25 21:30:55 34 gaojianwei 1000 Accepted 768K 10MS C 2008-04-25 22:15:58 33 gaojianwei 1001 Wrong_Answer 904K 10MS C 2008-04-25 22:18:01 32 gaojianwei 1004 Accepted 768K 10MS C 2008-04-25 22:24:23 31 lzz 1000 Accepted 904K 10MS C++ 2008-04-25 23:29:27 30 lzz 1001 Wrong_Answer 904K 10MS C++ 2008-04-25 23:30:17 示例输出: Rank Name Solved 1000 1001 1002 1003 1004 Penalty 1 gaojianwei 2 4:15:58 -1 0 0 4:24:23 8:40:21 2 602203621 1 0 0 0:04:59 0 0 0:04:59 3 ftest 1 3:30:32 0 0 0 0 3:30:32 4 lzz 1 5:29:27 0 0 0 0 5:29:27 5 liheyuan 0 0 0 -1 0 0 0:00:00

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值