您的位置:首页 > 其它

POJ 3664

2015-02-23 10:56 253 查看
水水更健康

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;
const int N=50100;

struct COW{
int f,s,d;
}cows
;

bool cmp1(COW a,COW b){
if(a.f>b.f) return true;
return false;
}

bool cmp2(COW a,COW b){
if(a.s>b.s) return true;
return false;
}

int n,k;

int main(){
while(scanf("%d%d",&n,&k)!=EOF){
for(int i=0;i<n;i++){
scanf("%d%d",&cows[i].f,&cows[i].s);
cows[i].d=i+1;
}
sort(cows,cows+n,cmp1);
sort(cows,cows+k,cmp2);
printf("%d\n",cows[0].d);
}
return 0;
}


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: