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

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

The problem is Almost Arithmetic Sequences.

Accepted Solution

Time limit exceeded

Can someone please figure out why is this happening?

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

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

O(n2) and O(n(n - 1)) is the same in terms of big O notation. Are you sure you need set in your programs? Your slower program is because you add O(n2) elements to set. Maybe list or vector will be enough? Or iterating over elements instead of a new structure?