I’m working through the Silver>Sorting&Sets>Sorting with custom comparators page. Link to that page:
https://usaco.guide/silver/sorting-custom.
For the Wormhole sort example, they show two methods of sorting based on weight. With the first method, they create a vector of nested pairs. Then they use the sort method. How does the sort method automatically know to sort the vector based on the second nested pair value?
Similarly, in their second method of sorting, they make a vector of arrays. Again, how does the sort command know to sort it based on the third value of the array?
Any help would be well appreciated!
Thanks!