What is the time complexity of sorting a vector of vector

Revision en1, by tezk, 2023-03-21 00:33:22

I tried to solve 1801C-Music Festival. First I also compress the albums as the editorial solution, then normalize all the coolness value to avoid the case the maximum of $$$a_i$$$ is too big, then sort the albums in increasing order of the track with maximum coolness. This got me TLE at test case 25

In short, I have a

vector<vector<int>> a(n);

The sort function is

sort(a.begin(), a.end(), [&] (auto a1, auto a2) {
    return (a1.back() < a2.back());

Instead of sorting, create a map to store the position of albums with each maximum coolness pass

I didn't know about this, so I'm curious what's the time complexity of the sort function in this case ?

Tags sorting, time complexity


  Rev. Lang. By When Δ Comment
en1 English tezk 2023-03-21 00:33:22 936 Initial revision (published)