Advertisement
Levine

Untitled

Dec 9th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. n=int(input())
  2. k=[0,0,0,0]
  3. a=[0,0,0,0]
  4. r=[0,0,0,0]
  5. for i in range(n):
  6. x,y=map(int,input().split())
  7.  
  8. if x==0 or y==0:
  9. continue
  10.  
  11. current_k = 0
  12.  
  13. if x > 0 and y > 0:
  14. current_k = 0
  15. elif x < 0 and y > 0:
  16. current_k = 1
  17. elif x > 0 and y < 0:
  18. current_k = 2
  19. elif x < 0 and y < 0:
  20. current_k = 3
  21.  
  22. k[current_k]+=1
  23.  
  24. if a[current_k] == 0:
  25. a[current_k] = [x, y]
  26. elif abs(a[current_k][0]) < abs(x) or abs(a[current_k][1]) < abs(y):
  27. a[current_k] = [x, y]
  28.  
  29. if r[current_k] == 0:
  30. r[current_k] = min(abs(x), abs(y))
  31.  
  32. r[current_k] = min(abs(x), abs(y), abs(r[current_k]))
  33.  
  34. #k[k,k,k,k]
  35. #a[a,a,a,a]
  36. #r[r,r,r,r]
  37.  
  38. kmax=max(k)
  39. rmax=-1
  40. K,M,A,R=0
  41. if k.count(kmax)==1:
  42. z=k.index(kmax)
  43. print(z,kmax,a[z],r[z],sep='\n')
  44. else:
  45. for i in range(4):
  46. if k[i]==kmax and r[i]>rmax:
  47. rmax=r[i]
  48. K=i
  49. M=k[i]
  50. A=a[i]
  51. R=rmax
  52. print(K,M,A,R,sep='\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement