//知道爲什麼幾次提交都是WA了,原來是struct沒有初始化,對於任何程序,細節決定成敗
#include<iostream>
#include<algorithm>
using namespace std;
#define SIZE 50010
struct vote
{
vote(): a(0),b(0),num(0){};
int a;
int b;
int num;
};
int cmp1(vote t1,vote t2)
{
return t1.a>t2.a;
}
int cmp2(vote t1,vote t2)
{
return t1.b>t2.b;
}
int main()
{
vote cow[SIZE];
int m,n;
cin>>m>>n;
for(int i=0;i<m;++i){
cin>>cow[i].a>>cow[i].b;
cow[i].num=i+1;
}
sort(cow,cow+m,cmp1);
sort(cow,cow+n,cmp2);
cout<<cow[0].num<<endl;
return 0;
}
POJ3664
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.