ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1788. On the Benefits of Umbrellas

TEST 3 Please
Posted by Jumabek Alikhanov 16 May 2015 05:05
I have got error so many times. Wonder wht I am missing..
Here is my Python 3.4 Code

n,m=map(int,input().split())
g=list(map(int,input().split()))
b=list(map(int,input().split()))

g.sort()
b.sort()

minUpset=0


for i in range(0,n):
    minUpset+=g[i]

for s in range(0,min(n,m)):
    girlsUpset=0
    boysUpset=0
    for i in range(0,n-s):
        girlsUpset+=g[i]
    for j in range(0,m-s):
        boysUpset+=b[j]
    minUpset=min(girlsUpset+boysUpset*s,minUpset)

print(minUpset)
Re: TEST 3 Please
Posted by Jumabek Alikhanov 16 May 2015 05:16
Found the mistake.
Always need to test when use loop.
Re: TEST 3 Please
Posted by Mikhail 4 Jun 2018 14:06
for s in range(0, min(n, m) + 1)