arham___khan's blog

By arham___khan, history, 3 years ago, In English

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?

Full text and comments »

  • Vote: I like it
  • -9
  • Vote: I do not like it

By arham___khan, history, 4 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • +2
  • Vote: I do not like it