XLR8ST's blog

By XLR8ST, history, 9 years ago, In English

I'm trying to do MCHEF from codechef long july 2015 . I've tried to implement what is written in the editorial but i'm constantly getting tle , The complexity of my solution seems to be enough to pass the constraints.Why am i getting TLE?? help !!

LINK TO CODE- http://pastebin.com/T5ZxchXL

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

you are using long long datatype everywhere , you should switch to int wherever possible (final answer doesnt fit in int) , also you are using a set which is quite slow as compared to a priority queue , you should use a priority_queue . You can Have a look at my solution : https://www.codechef.com/viewsolution/7352983