Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя rrepeat

Автор rrepeat, история, 8 лет назад, По-английски

For problem 710B following solutions:

  1. AC solution using collections.sort.
  2. TLE solution using Arrays.sort.

Does this mean Arrays.sort is slow, and should not be used in contests ? Anybody encountered such problem before ?

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

»
8 лет назад, # |
  Проголосовать: нравится +14 Проголосовать: не нравится

The worst case sort for Arrays.sort() of a primitive data type is O(n^2) i believe. Try changing your array type to Integer and use Arrays.sort(). That might give you Accepted.