afrizal's blog

By afrizal, 10 years ago, In English

Hello everyone

I had submitted some solutions on 443C. They got WA on test 3 (even after I use 2 different languages, cpp and java). But when I tested in my compiler (g++ 4.8.1 and JDK 1.7.0), custom invocation on CF, and even ideone.com, they make correct output.

Could someone tell me whats happened? Thank you for your help

C++ submission : 6934350

Tested in ideone.com

Java submission : 6936214

Tested on ideone.com

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

»
10 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

welp, on my machine and custom invocations for Java 7/8 and c++ return integer.max_value for the third sample test case. Are you sure you haven't changed anything in source code?

edit: I re-run your code on ideone again, and it does output integer.max_value. http://ideone.com/n6EuzN

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

    Making your class public breaks it for some reason.

    • »
      »
      »
      10 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      I'm sure i don't change anything. Also i've changed class to public and still output 4

      edit : this code works well in public class http://ideone.com/zZ0l5e

      • »
        »
        »
        »
        10 years ago, # ^ |
        Rev. 2   Vote: I like it +2 Vote: I do not like it

        The test case you are using is obviously different (i.e. your code doesn't handle the third sample correctly). Why would you test with a different test code on ideone, and confuse others?

»
10 years ago, # |
  Vote: I like it +1 Vote: I do not like it

You've run the problem on a different testcase on ideone.