Скоро Codeforces Round 1133 (Div. 1, Div. 2)! Регистрация здесь. ×

Блог пользователя Mr.Awesome

Автор Mr.Awesome, история, 10 лет назад, По-английски

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?

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

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

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

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

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