#K54077. Building Lock Simulation
Building Lock Simulation
Building Lock Simulation
In this problem, you are given a series of passcode attempts and the correct passcode. The security system of a building will lock the building if there are three consecutive incorrect passcode entries. Once the building is locked, the outcome is fixed and the system does not consider further attempts. When a correct passcode is entered, the counter for consecutive incorrect attempts is reset to zero.
Formally, let (a_1,a_2,\dots,a_n) be the passcode attempts and let (c) be the correct passcode. The building is locked if there exists an index (i) such that (a_i \neq c,\ a_{i+1} \neq c,\ a_{i+2} \neq c). Otherwise, the building remains unlocked.
inputFormat
The input is given from stdin and consists of three lines:
- An integer (n) representing the number of passcode attempts.
- (n) space-separated 4-digit strings representing the passcode attempts.
- A single 4-digit string representing the correct passcode.
outputFormat
Output to stdout a single boolean value: print True
if the building is locked after processing the attempts, otherwise print False
.## sample
4
1234 2345 0000 1111
9999
True
</p>