poj 3664(水题)


#include
#include
using namespace std;
struct node{
    int ID,a,b;
}Node[50005];
bool cmp(node n1,node n2){
    if(n1.a>n2.a)return true;
    return false;
}
bool cmp2(node n1,node n2){
    if(n1.b>n2.b)return true;
    return false;
}
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=0;i){
        scanf("%d%d",&Node[i].a,&Node[i].b);
        Node[i].ID = i+1;
    }
    sort(Node,Node+n,cmp);
    sort(Node,Node+k,cmp2);
    printf("%d\n",Node[0].ID);
    return 0;
}

相关