c++ priority queue solution
Explanation:->\n1. since we have to keep the order as well so we will use pair with priority queue to store element ans its idx.\n2. after that we will store id
**Explanation:->**\n1. since we have to keep the order as well so we will use pair with priority queue to store element ans its idx.\n2. after that we will store idx in sorted form so that we get back our original idx.\n3. then push the nums value using these idx in vector and then return it\n\n```\npriority_queue<pair<int,int>> pq;\n    for(int i=0;i<nums.size();i++)\n        pq.push({nums[i],i});\n    \n    vector<int> index;\n    while(k--){\n        pair<int,int> t=pq.top();\n        index.push_back(t.second);\n        pq.pop();\n    }\n    sort(index.begin(),index.end());\n    \n    vector<int> ans;\n    for(int i=0;i<index.size();i++)\n        ans.push_back(nums[index[i]]);\n    \n    return ans;\n```
[]