Skip to content

Commit

Permalink
2018_03_13
Browse files Browse the repository at this point in the history
  • Loading branch information
suhyeonjin committed Mar 13, 2018
1 parent 2921026 commit e86c80c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Baekjoon/wellKnowA1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
N, Q, U, V = map(int, raw_input().split(' '))
A_sequence = map(int, raw_input().split(' '))
Max = 0


def Query1(C, A, B):
global N, Q, U, V, A_sequence, Max
tmpSum = sum(A_sequence[A-1:B])
#print '[!]',A-1, B, tmpSum
#print "[-]",tmpSum

#if (Max < U*tmpSum+V*(len(A_sequence)-1)):
Max = U*tmpSum+V*(B-A)
print Max

# KA = B
def Query2(C, A, B):
global N, Q, U, V, A_sequence
A_sequence[A-1] = B
#print A_sequence


for i in range(int(Q)):
C, A, B = map(int, raw_input().split(' '))
if (C == 0):
Query1(C, A, B)

else:
Query2(C, A, B)

0 comments on commit e86c80c

Please sign in to comment.