Guess Prime

what is the meaning of wrong answer verdict given in the interaction of guess prime problem??

1 Like

(post deleted by author)

13 Likes

Love those links given by you :joy::joy::joy:

1 Like

It might mean several things, two of them are:

  1. You guessed the wrong prime.
  2. The problem statement says this at many places - " immediately terminate your program to receive the Wrong Answer verdict", if your program does one of those things, you get WA; if it doesn’t, you can get any verdict including WA.
1 Like

Actually I tried both, terminating if input is -1 and also by not terminating. Turns out both were accepted. And also the input yes/no doesn’t matter.

how can a solution getting input -1 get AC ??
It’s not guaranteed that you won’t receive WA if you don’t terminate.
It’s just a precaution to make sure that you recieve WA in case you are giving wrong output instead of other non AC verdicts like TLE,RE etc.
Cuz judge stops reading and printing anything once it detects that you gave wrong answer( after printing -1 obv). Now if you still try to interact ( read answers from judge) then you may read garbage or some error might occur (effect differs from language to language and maybe code to code as well).
For example java gives runtime error if it can’t find relevant input ( if you try to scan int even though its not provided in input etc).

I meant to say, if the solution is correct then it would never get -1 or no as the input from the judge, so it doesn’t matter. right?

doesn’t matter if its AC. I mean we don’t need to check if its -1 or not OR if its yes or no.
Simple because it will be Yes and not -1.

1 Like