Concurso

Problem Link

Solution by mateusgrl39100 pts

Code / Notes

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, K;
    cin >> N >> K;

    int freq[101] = {0};

    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        freq[x]++;
    }

    int soma = 0;

    for (int nota = 100; nota >= 1; nota--) {
        soma += freq[nota];
        if (soma >= K) {
            cout << nota << endl;
            break;
        }
    }
}

Last updated 1 month, 3 weeks ago


« Back to problem