C++ | faster than 94%, clear solution
\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) {\n        vector<pair<int,int>> vc;
```\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) {\n        vector<pair<int,int>> vc;\n        for(int i = 0; i < difficulty.size(); i++) vc.push_back(make_pair(difficulty[i], profit[i]));   \n        sort(vc.begin(), vc.end());\n        for(int i = 1; i < vc.size(); i++) vc[i].second=max(vc[i].second, vc[i-1].second);\n         \n        sort(worker.begin(), worker.end());\n        int  x = 0, ans=0;\n        for(int i = 0; i < worker.size(); i++){\n            while(vc[x].first<=worker[i] && vc.size()>x){\n                x++;\n            }\n            ans+=x==0?0:vc[x-1].second;\n        }\n        return ans;\n    }\n};\n\n```
['C', 'Sorting', 'C++']