Hredoy_Biswas's blog

By Hredoy_Biswas, history, 6 years ago, In English

Yesterday I was submitted the problem B in the contest time and it was pretest passed. But after finishing the contest it got the wrong answer on test 15. But its output is correct in my laptop compiler. then same code i submitted again then it got the wrong answer on test 37 though it gave correct output .again i submitted code removing space but it WA on test 2.In my own laptop, it is given correctly for all test. What's the wrong with me ??

My Submission :http://codeforces.me/submissions/Hredoy_Biswas

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

| Write comment?
»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

There is no problem in java compiler on Codeforces. You used BigInteger.isProbablePrime(int certainty) method with certainty=1 which is not-deterministic and returns whether a prime number is prime with probability p ~= (1-1/2^certainty). So this behaviour is expected that sometimes it may give the non-prime number to be prime and some other times non-prime.

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

    Dang, 1/2 chance to fail on every case and he made it to 37? That's solid.

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

      Actually its guaranteed to be at least (1-1/2^certainty). In the general case, it is much more.