Cod sursa(job #2628622)
| Utilizator | Data | 16 iunie 2020 16:29:38 | |
|---|---|---|---|
| Problema | Statistici de ordine | Scor | 50 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <iostream>
#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> s;
ifstream f("sdo.in");
ofstream g("sdo.out");
int n, k;
int main()
{
f >> n >> k;
for(int i=1; i<=n; i++)
{ int x;
f >> x;
s.insert(x);
}
//k = n - k + 1;
g << *s.find_by_order(k-1) << '\n';
return 0;
}
