Concise C++ solution using map as a BST
\nint maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) {\n    map<int, int> m{{0,0}};\n    for (int i = 0; i < difficulty.
```\nint maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) {\n    map<int, int> m{{0,0}};\n    for (int i = 0; i < difficulty.size(); i++) // create the difficulty-maximum-profit BST\n        m[difficulty[i]] = max(m[difficulty[i]], profit[i]);\n    int mx = 0, res = 0;\n    for (auto &p : m) // update the BST to reflect the maximum profit for a job\n        mx = p.second = max(p.second, mx);\n    for (int w : worker) // look up the BST to find the maximum profit for each worker\n        res += prev(m.upper_bound(w))->second;\n    return res;\n}\n```
[]