提交时间:2023-11-08 13:08:26
运行 ID: 109258
#include <bits/stdc++.h> using namespace std; struct node { int 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; } int main() { int n , k; cin >> n >> k; 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; }