OpenFIPI 2.0
26
6
AD6F70
21028 6660
f = open('301_26.txt')
n, m, k = map(int, f.readline().split())
a = [[int(i) for i in line.split()] for line in f.read().strip().split('\n')]
d = dict()
for row, col in a:
if col not in d or row < d[col]:
d[col] = row
mx_row = 0
for col in range(1, k):
mx = min(d.get(col, m + 1) - 1, d.get(col + 1, m + 1) - 1)
if mx > mx_row:
mx_row = mx
c = col
print(mx, c)
f.close()
Просмотреть отправленные ответы AD6F70