rishi's blog

By rishi, history, 23 months ago, In English

It fails at test case #31. 54092984

 
 
 
 
  • Vote: I like it
  • +2
  • Vote: I do not like it

»
23 months ago, # |
  Vote: I like it +16 Vote: I do not like it

Length of path can be up to 10^11, while your inf is 10^9.

  • »
    »
    23 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Still giving me the same result. 54128028

    • »
      »
      »
      23 months ago, # ^ |
        Vote: I like it +5 Vote: I do not like it

      At first, long in c++ is same as int (as far as I know). At second, try writing something like cout << inf << endl; You will see some strange number, not 10^11. To avoid overflow you should cast everything to long long's. See this. 54098620