poj3664 排序
2019-12-03 本文已影响0人
暖昼氤氲
/*
Time:2019.12.3
Author: Goven
type:排序
err:
ref:
*/
#include<iostream>
#include<algorithm>
using namespace std;
struct Vote{
int a, b;
int idx;
};
Vote cows[50005];
bool cmpa(const Vote &x, const Vote &y) {
return x.a > y.a;
}
bool cmpb(const Vote &x, const Vote &y) {
return x.b > y.b;
}
int main()
{
int n, k;
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> cows[i].a >> cows[i].b;
cows[i].idx = i;
}
sort(cows, cows + n, cmpa);
sort(cows, cows + k, cmpb);
cout << cows[0].idx + 1 << endl;
return 0;
}