Блог пользователя arham___khan

Автор arham___khan, история, 3 года назад, По-английски

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:

How to implement the above-mentioned three ways of sorting?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -9
  • Проголосовать: не нравится

Автор arham___khan, история, 3 года назад, По-английски

This is the following problem. CSES Problem Set Movie Festival II This is my approach (https://cses.fi/paste/4d6196360ee8fd8e21094e/) It's failing a few cases I wanted to know if my approach is completely wrong or I'm not handling some cases properly.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится