c++ solution using multiset
\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int m, vector<int>& nums)\n    {\n        int n=nums.size();\n        multiset<long long>s(nums.begin()
```\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int m, vector<int>& nums)\n    {\n        int n=nums.size();\n        multiset<long long>s(nums.begin(),nums.end());\n        s.insert(INT_MAX); // boundary condition \n        s.insert(INT_MIN); // boundary condition\n        long long mass=m;\n        while(s.size())\n        {\n            auto it=s.lower_bound(mass);\n            if(*it==INT_MAX) return true;\n            if(*it<=mass)\n            {\n                mass+=*it;\n            }\n            else\n            {\n                it--;\n                if(*it==INT_MIN)\n                {\n                    return false;\n                }\n                else\n                {\n                    mass+=*it;\n                }\n            }\n            s.erase(it);\n        }\n        return true;\n    }\n};\n```
['C', 'Sorting', 'C++']