Cod sursa(job #2892202)
Utilizator | dumnezEU hobbitczx | Data | 21 aprilie 2022 11:36:03 |
---|---|---|---|
Problema | Statistici de ordine | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.48 kb |
#include <bits/stdc++.h>
using namespace std;
const string fisier = "sdo";
ifstream fin (fisier + ".in");
ofstream fout (fisier + ".out");
const int N_MAX = 3e6 + 5;
int a[N_MAX];
void test_case() {
int n, k; fin >> n >> k;
for (int i=1; i<=n; i++){
fin >> a[i];
}
nth_element(a + 1 , a + k , a + n + 1);
fout << a[k];
}
int main(){
ios_base::sync_with_stdio(false);
int tests = 1;
for (int tc=0; tc<tests; ++tc) {
test_case();
}
}