Submission #21

Details and source code

Back to submissions
IDTimeUserProblemLangVerdict
21Mar 22, 2025, 04:03 PMadminOperative Task ForcecppAC

Source Code

cpp
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while(t--){
        int n;
        long long x;
        cin >> n >> x;
        vector<long long> agents(n);
        for (int i = 0; i < n; i++)
            cin >> agents[i];
        sort(agents.begin(), agents.end(), greater<long long>());
        int groups = 0, count = 0;
        for (int i = 0; i < n; i++){
            count++;
            if (agents[i] * count >= x){
                groups++;
                count = 0;
            }
        }
        cout << groups << "\n";
    }
    return 0;
}