Guest User

Untitled

a guest
Aug 22nd, 2019
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class FUCK:
  2. def __init__(self):
  3. self.x = list()
  4. self.n = 0
  5.  
  6. def CREATE(self, N):
  7. self.n = N
  8. self.x = [0] * self.n
  9.  
  10. def SET(self, L, R, val):
  11. for i in range(L, R):
  12. self.x[i] = val
  13.  
  14. def GET_MIN(self, L, R):
  15. return min((self.x[i] for i in range(L, R)))
  16.  
  17. def ADD(self, L, R, val):
  18. for i in range(L, R):
  19. self.x[i] += val
  20.  
  21. def GET_SUM(self, L, R):
  22. return sum((self.x[i] for i in range(L, R)))
  23.  
  24. def PRINT(x):
  25. print(x, end=' ')
  26.  
  27. # Example:
  28. f = FUCK()
  29. f.CREATE(15)
  30. for I in range(0,13 +1):
  31. J = 0
  32. while (I - J >= 0) and (I + J <= 15):
  33. f.ADD(I - J, I + J, J * ((I % 2) * 2 - 1))
  34. J += 1
  35. f.SET(I, I + 2, f.GET_MIN(I, I + 2))
  36. PRINT(f.GET_MIN(0, 15))
  37. PRINT(f.GET_MIN(1, 2))
  38. PRINT(f.GET_MIN(4, 5))
  39. PRINT(f.GET_MIN(11, 14))
RAW Paste Data