Cod sursa(job #3226385)

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