Rezultati

Up. imeNalogaJezikRezultatČas oddaje
muzik-2018 Arbitraža Python 3 100/100OK 13. okt '18 @ 13:56

Test Točke Porabljen spomin Porabljen čas Status
#1 11/11 8,695 MiB 0,000 s OK
#2 11/11 30,191 MiB 0,463 s OK
#3 11/11 21,754 MiB 0,026 s OK
#4 11/11 19,281 MiB 0,000 s OK
#5 11/11 19,398 MiB 0,000 s OK
#6 11/11 21,938 MiB 0,174 s OK
#7 11/11 22,238 MiB 0,260 s OK
#8 11/11 8,746 MiB 0,000 s OK
#9 12/12 10,078 MiB 0,000 s OK

Ocenjevani program (arb2.py):
import sys, math
sys.setrecursionlimit(10**9)

#sys.stdin = open("a.in")

inp = sys.stdin

n, m, k = map(int,inp.readline().split())

pi = list(map(int, input().strip().split()))
pi.sort(reverse=True)

si = list(map(int, input().strip().split()))
si.sort(reverse=True)

while len(pi) <= k:
    pi.append(0)

while len(si) <= k:
    si.append(0)

skupni = [0]
aa = 0
for i in range(min(len(pi), len(si))):
    aa += si[i]*pi[i]
    skupni.append(aa)

p = [0]
ap = 0
for i in range(len(pi)):
    ap += pi[i]
    p.append(ap)

s = [0]
ss = 0
for i in range(len(si)):
    ss += si[i]
    s.append(ss)

M = 0

for a in range(k+1):
    b = min(k-a, m)
    if a <= n and b <= m:
        if a < b:
            M2 = b * (skupni[a] + s[b] - s[a])
            M = max(M, M2)
        else:
            M2 = a * (skupni[b] + p[a] - p[b])
            M = max(M, M2)
print(M)