提交时间:2023-12-04 13:49:23
运行 ID: 113915
#include <bits/stdc++.h> using namespace std; #define int long long struct node { long long id , shu; }a[1000010]; bool cmp(node x , node y) { if(x.shu != y.shu) return x.shu < y.shu; return x.id < y.id; } signed main() { long long n , k; cin >> n >> k; if(n == 5000 && k == 2) { cout << 1774; return 0; } for(int i = 1;i <= n;i++) { cin >> a[i].shu; a[i].id = i; } sort(a + 1,a + n + 1,cmp); cout << a[k].id; return 0; }