2019-05-21 P1068

作者: 桐桑入梦 | 来源:发表于2019-05-21 14:20 被阅读0次

题目链接:https://www.luogu.org/problemnew/show/P1068

#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=5000+10;
int m,n;
struct Node{
    int id;
    int score;
}A[maxn];

bool cmp(Node x,Node y){
    if(x.score != y.score ) return x.score>y.score;
    else return x.id<y.id;
}

int main(void){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%d%d",&A[i].id,&A[i].score);
    }
    sort(A+1,A+n+1,cmp);
    m=m+m/2;
    while(m+1<=n && A[m].score==A[m+1].score) m++;
    printf("%d %d\n",A[m].score,m);
    for(int i=1;i<=m;i++){
        printf("%d %d%c",A[i].id,A[i].score,'\n');
    } 
    return 0;
} 

相关文章

网友评论

    本文标题:2019-05-21 P1068

    本文链接:https://www.haomeiwen.com/subject/twqjzqtx.html