-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path1514.py
More file actions
46 lines (39 loc) · 1020 Bytes
/
Copy path1514.py
File metadata and controls
46 lines (39 loc) · 1020 Bytes
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
45
46
while True:
n, m = input().split()
n, m = int(n), int(m)
if n == m == 0:
break
carac = 4
competidor = []
for i in range(n):
competidor.append([int(x) for x in input().split()])
# Caracteristica 1
# Ninguem resolveu todos
for i in range(n):
p = competidor[i].count(1)
if p == m:
carac -= 1
break
# Caracteristica 2
# Todo problema foi resolvido por pelo menos 1
problema = [0] * m
for i in range(n):
for j in range(m):
if competidor[i][j] == 1:
problema[j] += 1
if problema.count(0) > 0:
carac -= 1
# Caracteristica 3
# Nao ha nenhum problema resolvido por todos
for j in range(m):
if problema[j] == n:
carac -= 1
break
# Caracteristica 4
# Todos resolveram pelo menos 1
for i in range(n):
p = competidor[i].count(0)
if p == m:
carac -= 1
break
print(carac)