fork download
  1. import sys
  2.  
  3. while True:
  4. try:
  5. size = int(input())
  6. row1 = list(map(int,input().split()))
  7. row2 = list(map(int,input().split()))
  8. except EOFError:
  9. break
  10.  
  11. max = 0
  12. if len(row1) > 0:
  13. for i in range(size):
  14. t = min(row1)
  15. if row1.count(t) == 1:
  16. row1.remove(t)
  17. indices = [i for i,x in enumerate(row1) if x == t]
  18. if not indices[1] - indices[0] == 1:
  19. row1.remove(t)
  20. row1.remove(t)
  21. if t > max:
  22. max = t
  23. if len(row2) > 0:
  24. for j in range(size):
  25. t = min(row2)
  26. if row2.count(t) == 1:
  27. row2.remove(t)
  28. indices = [i for i,x in enumerate(row2) if x == t]
  29. if not indices[1] - indices[0] == 1:
  30. row2.remove(t)
  31. row2.remove(t)
  32. if t > max:
  33. max = t
  34. print (max)
  35.  
Runtime error #stdin #stdout #stderr 0.02s 28384KB
stdin
5
1 2 3 4 5
1 2 3 4 5
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 18, in <module>
IndexError: list index out of range