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

Автор spectaclehong, история, 7 лет назад, По-английски

http://codeforces.me/contest/913/submission/34021734 Accepted

http://codeforces.me/contest/913/submission/34049526 Wrong answer on test 4

http://codeforces.me/contest/913/submission/34049558 Accepted

What is diffrent ? I edit just one line about ll b in dfs function..

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
7 лет назад, # |
Rev. 2   Проголосовать: нравится +11 Проголосовать: не нравится

1e19 is of type double, and for the ternary operator types must match, thus the return value of dfs is cast to double. Double can't represent every integer value up to 10^19 precisely, thus the error, I think.

edit: you could also declare 1e19 as a long double (1e19L), which can represent every int up to 10^19 precisely (at least on most systems) 34050510