Solution fails on C++17, but works as expected on C++14

Revision en1, by AshwinBanwari, 2021-09-14 09:21:48

https://mirror.codeforces.com/contest/678/submission/128786847

With C++17, passing the an int into a function(lcm) which accepts a long long for some reason does not cast it to a long long but keeps it as an int. Then, unsurprisingly after being multiplied with another large int, it overflows.

On C++14 which I compiled locally initially, the int was implicitly converted to long long as expected and my solution worked.

Does anyone know why this is happening? I played around with gdb and compiling using C++17 and my gdb just went haywire once I entered the lcm function with the long long parameter.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English AshwinBanwari 2021-09-14 09:21:48 667 Initial revision (published)