If I have a map<string,pair<int,int>> and I want to sort it in three different ways. 1.Sort by key. 2.Sort by value of first element in the pair. 3.Sort by value of second element in the pair.
Example : if mp [ {a,{9,7}} {y,{2,5}} {g,{3,1}} {i,{6,6}} {e,{1,2}} ]
1.Sort by key:
2.Sort by value of first element in the pair:
3.Sort by value of second element in the pair:
Elements in the map are sorted by default by the key.
you can't change its order
hey can someone help me with this problem? https://codeforces.net/contest/143/problem/A this is my solution https://pastebin.com/ViwFKvWP
You should make your own post describing in short:
Instead of having this convoluted of a data structure, try to come up with a better way of implementing all around.