MAXEP: What to do if we run out of coins

I just terminated the program once the coin value either falls below 1 or c(and the panel is broken). But while submitting I was getting a wrong answer. I was wondering do we need to do something else rather than terminate it??

To get a correct answer you have to establish the limit voltage. You need to do this without running out of coins (and you always can, within the constraints given - see the many 100-point scores). I would assume that the judging program is keeping track of how many coins you have used and will mark your program incorrect if it attempts to use more then 1000, or (of course) if it gives the wrong answer.

With the right approach, you will have sufficient coins that you can also leave the panel in working order - that is, if your last query broke it, you should have enough coins to fix it, even though that isn’t actually specified. It seems like the sensible thing to do, plus the example fixes the panel before reporting out.

@sbatten1969 wouldn’t giving random answers be considered as wrong answers??

What is the meaning of invalid operation?

@anshks – Agreed! Giving a random wrong answer would definitely be consider a wrong answer. But I propose a wrong answer is better than not giving any answer at all.

If we run out of coins, we definitely haven’t solved the problem. (All test cases are solvable without running out of coins.) So if that happens, just return any answer (thus getting a WA) rather than giving NO answer or looping indefinitely. That was the point I was trying to convey.

I am getting WA in task 1 of subtask 1? how could i eliminate this

I am getting WA in task 1 of subtask 1? how could i eliminate this

what if the value of the panel we enter is -1 then what we have to do?

I was wondering do we need to do something else rather than terminate it??

Yes, solve it correctly.

Closed too early