Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

Mr.Awesome's blog

By Mr.Awesome, history, 10 years ago, In English

I was trying to solve this problem, after submitting my solution I got TLE and I couldn't figure out the problem with my O(n.log(n)) solution, I also checked some accepted solution and most of them are using the same approach?

my submission

UPD

I got accepted by copying someone sort function but I still want to know what's wrong with java.util.Arrays.sort function?

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

| Write comment?
»
10 years ago, hide # |
← Rev. 2  
Vote: I like it 0 Vote: I do not like it

probably because of sorting long integer array in Java, there was a post yesterday or a day before that about the same issue.

»
10 years ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

I have discussed about this already in this blog
Here is your AC code (Just shuffle the array before sorting)