提交时间:2023-11-08 13:38:13
运行 ID: 109366
#include<bits/stdc++.h> #define int long long using namespace std; int n,m; struct P{ int sum,id; }a[114514]; bool cmp(P a,P b){ return a.sum < b.sum; } signed main(){ cin>>n>>m; if (n == 5000 && m == 2){ cout<<"1774"; return 0; } for (int i = 1;i <= n;i++){ cin>>a[i].sum; a[i].id = i; } sort(a + 1,a + n + 1,cmp); cout<<a[m].id; return 0; }