30 lines
587 B
C++
30 lines
587 B
C++
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
const int N = 10010;
|
|
int a[N], b[N], bl;
|
|
int main() {
|
|
int n, k;
|
|
cin >> n >> k;
|
|
for (int i = 1; i <= n; i++) cin >> a[i];
|
|
sort(a + 1, a + 1 + n);
|
|
|
|
int x = a[1];
|
|
b[++bl] = x;
|
|
|
|
for (int i = 2; i <= n; i++) {
|
|
if (x == a[i]) continue;
|
|
x = a[i];
|
|
b[++bl] = x;
|
|
}
|
|
|
|
// for (int i = 1; i <= bl; i++)
|
|
// cout << b[i] << " ";
|
|
// cout << endl;
|
|
|
|
if (bl >= k)
|
|
cout << b[k] << endl;
|
|
else
|
|
cout << "NO RESULT" << endl;
|
|
|
|
return 0;
|
|
} |