-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1136.py
44 lines (41 loc) · 1.55 KB
/
1136.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
if __name__ == '__main__':
while True:
s = input()
if s == "0 0": # condição de parada
quit()
s = s.split()
n = int(s[0])
b = int(s[1])
stockGlobe = set()
for i in range(n + 1): # globo padrão
stockGlobe.add(i)
acmGlobe = set(map(int, input().split()))
acmList = sorted(acmGlobe) # lista do globo permanecente
checkGlobe = stockGlobe - acmGlobe
diffSet = set()
#print("Globo padrão {}".format(stockGlobe))
#print("Globo modificado ACM {}".format(acmGlobe))
#print("Globo lista ACM {}".format(acmList))
#print("Globo resultante {}".format(checkGlobe))
if len(checkGlobe) == 0:
print('Y')
else:
flag = False
for i in range(len(acmList) - 1, 0, -1):
# print(i)
if flag is True:
break
for j in range(i):
diff = acmList[i] - acmList[j]
if diff not in diffSet:
diffSet.add(acmList[i] - acmList[j])
if diff in checkGlobe:
checkGlobe.remove(diff) # remove elemento do globo
if len(checkGlobe) == 0: # globo esta vazio portanto
flag = True
break
#print("Globo diferencas {}".format(diffSet))
if flag is True:
print('Y')
else:
print('N')