Cod sursa(job #2701854)

Utilizator beingsebiPopa Sebastian beingsebi Data 1 februarie 2021 23:19:59
Problema Statistici de ordine Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.42 kb
#include <bits/stdc++.h>
using namespace std;
ifstream f("sdo.in");
ofstream g("sdo.out");
// #define f cin
// #define g cout
int n, t;
vector<int> v;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    f.tie(nullptr);
    g.tie(nullptr);
    f >> n >> t;
    t--;
    v.resize(n);
    for (int &i : v)
        f >> i;
    nth_element(v.begin(), v.begin() + t, v.end());
    g << v.at(t);
    return 0;
}