spectaclehong's blog

By spectaclehong, history, 7 years ago, In English

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

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

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

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

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
7 years ago, # |
Rev. 2   Vote: I like it +11 Vote: I do not like it

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