Beat 99.71% C++ solution
\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& d, vector<int>& p, vector<int>& w) {\n        int mp[100001] = {0}, res = 0;\n        for(
```\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& d, vector<int>& p, vector<int>& w) {\n        int mp[100001] = {0}, res = 0;\n        for(int i = 0; i < d.size(); i++)\n            mp[d[i]] = max(mp[d[i]], p[i]);\n        for(int i = 1; i < 100001; i++)\n            mp[i] = max(mp[i], mp[i - 1]);\n        for(auto n : w)\n            res += mp[n];\n        return res;\n    }\n};\n```
[]