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

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

Автор Krypto02, 2 года назад, По-английски

I was trying to solve a problem Codeforces Round 291 Div2 B. I have written the following solution with the idea of number of unique slopes being the answer. Please tell what is incorrect with my code. My Code : 166298188 .

Теги cpp, set
  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

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

Your slope doesnt work well when $$$x0 = x$$$ (it can either be -inf or inf depending on what y is). I would also recommend not using floats whenever possible to avoid precision issues. The editorial solution has a good workaround that, you should check it out!