OneClickAC's blog

By OneClickAC, history, 8 years ago, In English

well this has happened with me in so many problems and i really don`t know the reason behind it. My code fails on a particular test but when i enter that test on my own compiler , the answer comes out to be correct .. Earlier also , this has happened with me many times. 2 days back also , i encountered the same problem as why i am getting a runtime error on test 9 of Problem 659-B http://pastebin.com/UBV4KPf0 This is the link for my code..

Today i got stuck in Problem 725B in test 7 . Again I am getting correct output in my computer but wrong on Codeforces . http://pastebin.com/WuCR3X9p Link for 725-B(My code) Can anyone help me out with this???

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

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Codeforces compiler is fine. Your code is buggy. Read the manual http://en.cppreference.com/w/cpp/string/byte/atoi

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    But when i am entering the same input(test-7) in my computer , I am getting correct output..

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by OneClickAC (previous revision, new revision, compare).

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Provide a link to your submission.

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      • »
        »
        »
        »
        8 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Your solution is correct expect you used atol which return long, but the plane is arbitrarily long and can have a row which is longer than the maximum value of long. Just find a process to convert your string to a long long. You can also read the input using scanf, which can read this as a long long.

        Here is a fix to your code, just locate to atol you used. I made one change there.