deushiro

Untitled

Jun 20th, 2020
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. n = int(input())
  2. p = [12001] * 144
  3. a = 12001
  4. b = 12001
  5. for i in range(n):
  6.     x = int(input())
  7.     k = (144 - x % 144) % 144
  8.     if(p[k] < 12001 and x + p[k] < a + b and x > p[k]):
  9.         a = x;
  10.         b = p[k]
  11.     p[x % 144] = min(p[x % 144], x)
  12. if(a + b < 24002):
  13.     print(a, b)
  14. else:
  15.     print(0)
Advertisement
Add Comment
Please, Sign In to add comment