Cod sursa(job #1513584)
Utilizator | Data | 29 octombrie 2015 18:54:29 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.42 kb |
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
ifstream f("sdo.in");
ofstream g("sdo.out");
int n, k;
vector<int> V;
void read() {
f>>n>>k;
for (int i=1;i<=n;i++) {
int x; f>>x;
V.pb(x);
}
}
void solve() {
nth_element(V.begin(), V.begin() + k-1, V.end());
g<<V[k-1];
}
int main() {
read();
solve();
f.close(); g.close();
return 0;
}