C++ PRIORITY QUEUE
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> maximumSumQueries(vector<int>& nums1, vector<int>& nums2, vector<vector<int>>& queries) {\n        vector<vector<int>> v;\n        int i = 0, n = queries.size();\n        for(i = 0; i < n; i++){\n            v.push_back({queries[i][0],queries[i][1],i});\n        }\n        sort(v.begin(),v.end(),[&](vector<int> &a,vector<int> &b){\n            if(a[0]==b[0])return a[1]<b[1];\n            return a[0]<b[0];\n        });\n        priority_queue<vector<int>> pq1,pq;\n        \n        for(i = 0; i < nums1.size(); i++){\n            pq.push({nums1[i]+nums2[i],nums1[i],nums2[i]});\n        }\n        \n        vector<int> ans(n,-1);\n        for(auto &i: v){\n            while(!pq.empty()){\n                if(pq.top()[1]<i[0]){\n                    pq.pop();\n                }else if( pq.top()[2]<i[1]){\n                    pq1.push(pq.top());\n                    pq.pop();\n                }else{\n                    break;\n                }\n            }\n            if(!pq.empty()){\n                ans[i[2]] = pq.top()[0];\n            }\n            while(!pq1.empty()){\n                pq.push(pq1.top());\n                pq1.pop();\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']