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
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
Making your class public breaks it for some reason.
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
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?
You've run the problem on a different testcase on ideone.