forked from charlesfranciscodev/codingame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dont_panic1.py
27 lines (23 loc) · 859 Bytes
/
dont_panic1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from typing import Dict
if __name__ == "__main__":
elevators: Dict[int, int] = {}
_, _, _, exit_floor, exit_pos, _, _, n5 = map(int, input().split())
for _ in range(n5):
elevator_floor, elevator_pos = map(int, input().split())
elevators[elevator_floor] = elevator_pos
# For the last floor, we use the exit instead of an elevator.
elevators[exit_floor] = exit_pos
# game loop
while True:
line = input().split()
clone_floor = int(line[0])
clone_pos = int(line[1])
direction = line[2]
if clone_floor == -1:
print("WAIT")
elif direction == "LEFT" and clone_pos < elevators[clone_floor]:
print("BLOCK")
elif direction == "RIGHT" and clone_pos > elevators[clone_floor]:
print("BLOCK")
else:
print("WAIT")