Bluetooth

This commit is contained in:
2023-07-17 22:19:12 +02:00
parent 6d748103e0
commit ff54ec63ec

36
bluetooth.py Normal file
View File

@@ -0,0 +1,36 @@
n = int(input())
uleft = set(range(1, 9))
uright = set(range(1, 9))
lleft = set(range(1, 9))
lright = set(range(1, 9))
for _ in range(n):
dental_problem = input().split()
try:
if dental_problem[1] == "m":
if dental_problem[0][0] == "-":
lleft.remove(int(dental_problem[0][1]))
elif dental_problem[0][0] == "+":
uleft.remove(int(dental_problem[0][1]))
elif dental_problem[0][1] == "-":
lright.remove(int(dental_problem[0][0]))
elif dental_problem[0][1] == "+":
uright.remove(int(dental_problem[0][0]))
else:
if dental_problem[0][0] == "+" or dental_problem[0][0] == "-":
lleft = set()
uleft = set()
else:
lright = set()
uright = set()
except KeyError:
pass
if len(lleft) > 0 and len(uleft) > 0:
print(0)
elif len(lright) > 0 and len(uright) > 0:
print(1)
else:
print(2)