Bluetooth
This commit is contained in:
36
bluetooth.py
Normal file
36
bluetooth.py
Normal 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)
|
||||
Reference in New Issue
Block a user