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

Автор abhatter, история, 4 года назад, По-английски

Hello, I am trying to generate all permutations and for each permutation I am checking if the given conditions are satisfied and then counting it as part of the solution. But this approach times out as the time complexity is n*n!

I am not able to understand as to what can be precomputed.

Any help is appreciated.

Click for problem link

Thanks in advance

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