#cpp

Hi, I was solving a problem on LeetCode,
Link : here

My solution got "Time limit exceeded"

Solution :

class Solution {
public:
    vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {
        
        int m{int(potions.size())};
        std::sort(potions.begin(), potions.end());
        vector<int> res;
        
        for (long long i: spells){
            int t{0};
            for (long long j: potions){
                if ((i * j) >= success) break;
                else ++t;
            }
            res.push_back(m - t);
        }
        return res;
    }
};

Can anyone give some hints on how to improvise the time ?
I think mine in O(n*logn).