- C20250089's blog
A1176 谁考了第k名
- 2023-3-22 14:42:11 @
#include<bits/stdc++.h>
using namespace std;
int num[510];
double score[510];
int main(){
int n,pm;
cin>>n>>pm;
for(int i=1;i<=n;i++){
cin>>num[i]>>score[i];
}
for(int i=1;i<=n;i++){
int k=i;
for(int j=i;j<=n;j++){
if(score[j]>score[k]){
k=j;
}
}
swap(num[i],num[k]);
swap(score[i],score[k]);
}
cout<<num[pm]<<" "<<score[pm];
return 0;
}