Cod sursa(job #3232595)

Utilizator popescu_georgePopescu George popescu_george Data 31 mai 2024 07:20:17
Problema Statistici de ordine Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.46 kb
#include<bits/stdc++.h>
using namespace std;
ifstream F("sdo.in");
ofstream G("sdo.out");
#define Z 2048
int p=Z,n,k,i,a[3000000];
char s[Z];
inline char A()
{
    if(p==Z)
        F.read(s,Z),p=0;
    return s[p++];
}
int B()
{
    char c;
    for(c=A();!isdigit(c);c=A());
    int n=0;
    for(;isdigit(c);n=n*10+c-48,c=A());
    return n;
}
int main()
{
    for(n=B(),k=B();i<n;a[i++]=B());
    return nth_element(a,a+k-1,a+n),G<<a[k-1],0;
}