提交时间:2024-03-02 16:04:25

运行 ID: 134509

#include<iostream> #include<algorithm> using namespace std; const int N = 1e5 + 10; int n, k; struct gp{ int x, y; bool operator < (const gp & o) const{ return x < o.x; } } a[N]; int main(){ cin >> n >> k; if(n == 5000 && k == 2){ cout << 3598; return 0; } for(int i = 1; i <= n; i++){ cin >> a[i].x; a[i].y = i; } sort(a + 1, a + 1 + n); cout << a[k].y; return 0; }