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

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

I wasn't happy with the time complexity of my solution. So, I was looking for a solution with improved time complexity. And I found this. This guy solved this problem by only checking the first 200 elements after each index and comparing GCD of each pair . He won with the power of probability!

His submission: 184781213

Test Case

Test Case result should be Yes. His solution prints No

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

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

What about picking $$$\min(n, 100)$$$ numbers randomly and then trying all possible pairs of them? Will it work?

How to calculate the probability of getting it right?

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

Why does this work? I see it's AC and he got points for problem C