Cod sursa(job #3279495)

Utilizator PitigoiOlteanEmanuelPitigoi Oltean Emanuel PitigoiOlteanEmanuel Data 23 februarie 2025 12:25:37
Problema Statistici de ordine Scor 50
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.5 kb
#include <fstream>
#include <algorithm>
#include <map>
#include <vector>


using namespace std;
ifstream cin("sdo.in");
ofstream cout("sdo.out");
map <int,int> ma;
int n,m;


int main()
{

    cin>>n>>m;
    int x;
    for(int i=1;i<=n;i++){
        cin>>x;
        ma[x]++;
    }


    for(auto it :ma)
    {
        m-=it.second;
        if(m<=0)
        {
            cout<<it.first;
            return 0;
        }
    }



    return 0;
}






//manuscrisul voinici