Pagini recente » Cod sursa (job #1983913) | Cod sursa (job #1242511) | Cod sursa (job #3200805) | Cod sursa (job #790727) | Cod sursa (job #1961434)
#include <bits/stdc++.h>
using namespace std;
#define inline __inline__ __attribute__((always_inline))
#define optimized __attribute__((optimize("-O3")))
const int SIZE = 100000;
class InParser
{
private:
char buffer[SIZE];
int index;
inline optimized char next_char()
{
if(index == SIZE)
{
index = 0;
fread(buffer, 1, SIZE, stdin);
}
return buffer[index++];
}
public:
InParser()
{
index = 0;
fread(buffer, 1, SIZE, stdin);
}
inline optimized InParser& operator>>(int &x)
{
x = 0;
char c = next_char();
while(!isdigit(c))
c = next_char();
while(isdigit(c))
{
x = x * 10 + c - '0';
c = next_char();
}
return *this;
}
};
int a[3000001], n, k;
int main()
{
freopen("sdo.in", "r", stdin);
freopen("sdo.out", "w", stdout);
InParser in;
in>>n>>k;
for(int i = 0; i < n; i++)
in>>a[i];
nth_element(a,a+k,a+n+1);
printf("%d ",a[k]);
return 0;
}