Krypto02's blog

By Krypto02, 2 years ago, In English

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 .

Tags cpp, set
  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?
»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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!