0789 - Max 2 Ap
Rezolvare
<syntaxhighlight lang="python" line="1"> n, m = map(int, input().split())
matrix = [] for i in range(n):
row = list(map(int, input().split())) matrix.append(row)
seen = set() max_duplicate = None
for i in range(n):
for j in range(m): value = matrix[i][j] if value in seen and (max_duplicate is None or value > max_duplicate): max_duplicate = value else: seen.add(value)
if max_duplicate is None:
print("IMPOSIBIL")
else:
print(max_duplicate)
</syntaxhighlight>