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 .
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3773 |
3 | Radewoosh | 3646 |
4 | ecnerwala | 3624 |
5 | jqdai0815 | 3620 |
5 | Benq | 3620 |
7 | orzdevinwang | 3612 |
8 | Geothermal | 3569 |
8 | cnnfls_csy | 3569 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | Um_nik | 164 |
2 | cry | 161 |
3 | maomao90 | 160 |
4 | -is-this-fft- | 159 |
5 | atcoder_official | 158 |
5 | awoo | 158 |
7 | adamant | 155 |
8 | nor | 154 |
9 | maroonrk | 152 |
10 | Dominater069 | 149 |
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 .
Name |
---|
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!