ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1877. Bicycle Codes

What is wrong?
Posted by pimiento 24 Sep 2013 01:51
current_key = int(input().strip())
backup_key = int(input().strip())
for thief_key in range(0, 9999):
    if current_key == thief_key:
        print("yes")
        break
    if thief_key > current_key or thief_key > backup_key:
        print("no")
        break
    temp_key = backup_key
    backup_key = current_key
    current_key = temp_key

It passes tests with "0001/0000" -> no and "0002/0001" -> yes.
And I traced it, it works right.
But they said, that I have wrong answers.
Why?

P.S. Mistake of course was in the line:
if thief_key > current_key or thief_key > backup_key:

I should use and instead or.

Edited by author 24.09.2013 01:56