Cod sursa(job #3197509)
Utilizator | Data | 27 ianuarie 2024 00:05:20 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.29 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("sdo.in");
ofstream fout("sdo.out");
priority_queue<int> q;
int main()
{
int n,k;
fin>>n>>k;
for(int i=0;i<n;i++){
int x; fin>>x;
q.push(x);
if(q.size()>k) q.pop();
}
fout<<q.top();
return 0;
}