| 记录编号 | 
        32678 | 
        评测结果 | 
        AAAAAAAAAA | 
    
    
        | 题目名称 | 
        387.抗震救灾 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         Truth.Cirno | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.008 s  | 
    
    
        | 提交时间 | 
        2011-11-07 17:34:00 | 
        内存使用 | 
        0.78 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
using namespace std;
struct type1
{
	int num,len;
	char dis[50],nam[50];
};
type1 a[5001]={0};
void swaptype1(type1& a,type1& b)
{
	type1 temp;
	temp=a;
	a=b;
	b=temp;
}
void qqsort(int l,int r)
{
	int ll,rr;
	type1 temp;
	ll=l;
	rr=r;
	temp=a[rand()%(r-l+1)+l];
	while (ll<=rr)
	{
		while (a[ll].len<temp.len||(a[ll].len==temp.len&&strcmp(a[ll].dis,temp.dis)<0))
			ll++;
		while (temp.len<a[rr].len||(temp.len==a[rr].len&&strcmp(temp.dis,a[rr].dis)<0))
			rr--;
		if (ll<=rr)
		{
			swaptype1(a[ll],a[rr]);
			ll++;
			rr--;
		}
	}
	if (l<rr)
		qqsort(l,rr);
	if (ll<r)
		qqsort(ll,r);
}
int main(void)
{
	freopen("savez.in","r",stdin);
	freopen("savez.out","w",stdout);
	int i,n=1,now=0,total=0;
	while (scanf("%d %s %s\n",&a[n].num,&a[n].dis,&a[n].nam)==3)
	{
		total+=a[n].num;
		a[n].len=strlen(a[n].dis);
		n++;
	}
	n--;
	total=(total+1)/2;
	qqsort(1,n);
	for (i=1;i<=n;i++)
	{
		now+=a[i].num;
		if (now>=total)
		{
			printf("%s\n",a[i].nam);
			break;
		}
	}
	fclose(stdin);
	fclose(stdout);
	return(0);
}