lovrebuca's blog

By lovrebuca, history, 2 years ago, In English

I was solving the round #757(Div. 2), and finished problem B, and submitted my solution around one hour into the contest. I was pretty sure that my solution was correct and when submitting it, I got a wrong answer. It turned out that it was because I was using the C++20 complier instead of the C++17 which I usually use. At the end of the contest i submitted the code with the C++17 compiler and it turned out to be correct. I'd like if someone could look into that because i could have probably solved C if it wasn't for the bug that kept me stuck at problem B.

  • Vote: I like it
  • -19
  • Vote: I do not like it

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

You lose precision when you cast l from int to the float type. And narrowing conversions in C++ are implementation-defined. So, you were unlucky to know and use the float type in competitive programming.