Simple C++ solution
\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        vector<pair<int,int>>temp;\n        vector<int>v;\n        int 
```\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        vector<pair<int,int>>temp;\n        vector<int>v;\n        int n=nums.size();\n        for(int i=0;i<n;i++)\n        {\n            temp.push_back({nums[i],i});\n        }\n        sort(temp.begin(),temp.end());\n        vector<pair<int,int>>ans;\n        //int n=nums.size();\n        for(int i=n-1;i>=n-k;i--)\n            ans.push_back({temp[i].second,temp[i].first});\n        sort(ans.begin(),ans.end());\n        for(int i=0;i<ans.size();i++)\n            v.push_back(ans[i].second);\n        return v;\n    }\n};\n```
['C', 'Sorting', 'C++']