Cod sursa(job #3213364)

Utilizator AlexInfoIordachioaiei Alex AlexInfo Data 13 martie 2024 01:45:26
Problema Statistici de ordine Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.55 kb
#include <bits/stdc++.h>

using namespace std;

ifstream in("sdo.in");
ofstream out("sdo.out");

#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second

const int NMAX = 3e6+30;
const int INF = 0x3f3f3f3f;

int n, k, v[NMAX];

void read()
{
    in >> n >> k;
    for (int i = 1; i <= n; i++)
        in >> v[i];
}

void solve()
{
    sort(v + 1, v + n + 1);
    out << v[k];
}

int main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    read();
    solve();

    return 0;
}