comparison functions and classes/structs

Revision en1, by arjun_9426, 2018-12-19 17:26:21

hello friend, i suffer a lot because of comparison functions and classes for sorting and STL data structures please help me in clearing this

comparison functions ex-> (1).when i try to sort using comparison function like->https://ideone.com/owtUzJ here problem comes when i try to sort according to my wish (2). sometimes even vectors of simple numbers give TLE or runtime error when i try to sort them using comparision function eg->https://ideone.com/FhzWw2

classes and structs https://ideone.com/FhzWw2 in this case it reinsert the value???

https://ideone.com/0POMaG in this case it reinsert the key value pair instead of just updating it???

https://ideone.com/Ae2DMR(another example where entry repeats)

please help me in this, i have suffered a lot because of this, recent one is (1)https://codeforces.com/contest/1082/submission/47244078(runtime error) (2)https://codeforces.com/contest/1082/submission/47244104(accepted) both codes are exactly same, i have just managed the comparison function benefits through extra code in 2nd one.

please somebody tell if there is any other way to use these functions/structs more effectively, else what and how we can use them . please somebody help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English arjun_9426 2018-12-19 17:26:21 1289 Initial revision (published)