Created
August 10, 2019 00:09
-
-
Save stek29/f3824707b926241ffe241918c95e3085 to your computer and use it in GitHub Desktop.
park.mail.ru entry tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FUCK: | |
def __init__(self): | |
self.x = list() | |
self.n = 0 | |
def CREATE(self, N): | |
self.n = N | |
self.x = [0] * self.n | |
def SET(self, L, R, val): | |
for i in range(L, R): | |
self.x[i] = val | |
def GET_MIN(self, L, R): | |
return min((self.x[i] for i in range(L, R))) | |
def ADD(self, L, R, val): | |
for i in range(L, R): | |
self.x[i] += val | |
def GET_SUM(self, L, R): | |
return sum((self.x[i] for i in range(L, R))) | |
def PRINT(x): | |
print(x, end=' ') | |
# Example: | |
f = FUCK() | |
f.CREATE(15) | |
for I in range(0,13 +1): | |
J = 0 | |
while (I - J >= 0) and (I + J <= 15): | |
f.ADD(I - J, I + J, J * ((I % 2) * 2 - 1)) | |
J += 1 | |
f.SET(I, I + 2, f.GET_MIN(I, I + 2)) | |
PRINT(f.GET_MIN(0, 15)) | |
PRINT(f.GET_MIN(1, 2)) | |
PRINT(f.GET_MIN(4, 5)) | |
PRINT(f.GET_MIN(11, 14)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment