Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 11/11 8,680 MiB 0,000 s OK
#2 11/11 30,066 MiB 0,403 s OK
#3 11/11 15,441 MiB 0,063 s OK
#4 11/11 19,148 MiB 0,000 s OK
#5 11/11 19,465 MiB 0,000 s OK
#6 11/11 22,184 MiB 0,219 s OK
#7 11/11 21,746 MiB 0,240 s OK
#8 11/11 8,801 MiB 0,000 s OK
#9 12/12 8,723 MiB 0,000 s OK

Ocenjevani program (6.py):
import sys
#sys.stdin = open("3.in")



n, m, k = map(int, sys.stdin.readline().strip().split())

p = list(map(int, sys.stdin.readline().strip().split()))
s = list(map(int, sys.stdin.readline().strip().split()))

p.sort(reverse=True)
s.sort(reverse=True)

p_col = [0] * (n+1)
s_col = [0] * (m+1)
ps_col = [0] * (min(m,n) + 1)



for i in range(1,len(p)+1):
    if i==1:
        p_col[i] = p[i-1]
    else:
        p_col[i] = p_col[i-1] + p[i-1]

for i in range(1,len(s)+1):
    if i==1:
        s_col[i] = s[i-1]
    else:
        s_col[i] = s_col[i-1] + s[i-1]


for i in range(1, min(len(s), len(p)) + 1):
    if i==1:
        ps_col[i] = p[i-1]*s[i-1]
    else:
        ps_col[i] = ps_col[i-1] + p[i-1]*s[i-1]


def moc(a,b):
    if a>=b:
        M = a*(ps_col[b] + p_col[a] - p_col[b])
    else:
        M = b*(ps_col[a] + s_col[b] - s_col[a])
    return M


m_max = 0
for i in range(0, k+1):
    a = i
    b = k-i

    if a > len(p) and b >len(s):
        break
    if a>len(p):
        a = len(p)
    if b >len(s):
        b = len(s)

    m_cur = moc(a,b)
    if m_cur>= m_max:
        m_max = m_cur

print(m_max)