input stringlengths 20 127k | target stringlengths 20 119k | problem_id stringlengths 6 6 |
|---|---|---|
import heapq
x, y, a, b, c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
p = p[:x]
q = q[:y]
p = [-i for i in p]
q = [-i for i in q]
r = [-i for i in r]
result = [0]
... | x, y, a, b, c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
rr = [0]
for i in r:
rr.append(rr[-1]+i)
p = p[:x]
q = q[:y]
pq = sorted(p+q)
ppqq = [... | p02727 |
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
def main():
x, y, a, b, c = list(map(int, input().strip().split()))
p = sorted(list(map(int, input().strip().split())), reverse=True)[:x]
q = sorted(list(map(int, input().strip().spli... | import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
def main():
x, y, a, b, c = list(map(int, input().strip().split()))
p = sorted(list(map(int, input().strip().split())), reverse=True)
q = sorted(list(map(int, input().strip().split())... | p02727 |
X, Y, A, B, C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
p.reverse()
q.sort()
q.reverse()
d = 0
x = 0
y = 0
while x < X and y < Y:
a = max(p)
b = max(q)
c = max(r)
if a >= c:
... | X, Y, A, B, C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
p.reverse()
q.sort()
q.reverse()
del p[X:]
del q[Y:]
p.extend(q)
p.extend(r)
p.sort()
p.reverse()
del p[X+Y:]
d = sum(p)
print(d)
| p02727 |
x,y,a,b,c = list(map(int,input().split()))
lst_r = list(map(int,input().split()))
lst_g = list(map(int,input().split()))
lst_n = list([int(x)*(-1) for x in input().split()])
from heapq import *
heapify(lst_r)
for i in range(a-x):
_ = heappop(lst_r)
heapify(lst_g)
for i in range(b-y):
_ = heappop(l... | x,y,a,b,c = list(map(int,input().split()))
lst_r = list(map(int,input().split()))
lst_g = list(map(int,input().split()))
lst_n = list(map(int,input().split()))
lst_r = sorted(lst_r, reverse=True)[:x]
lst_g = sorted(lst_g, reverse=True)[:y]
lst_all = sorted(lst_r + lst_g + lst_n, reverse=True)[:x+y]
print((sum(ls... | p02727 |
from copy import copy
X, Y, A, B, C = [int(n) for n in input().split(' ')]
p = [int(n) for n in input().split(' ')]
q = [int(n) for n in input().split(' ')]
r = [int(n) for n in input().split(' ')]
p.sort()
q.sort()
ans = 0
for flag in range(1<<len(r)):
P = copy(p[-X:])
Q = copy(q[-Y:])
for... | from copy import copy
X, Y, A, B, C = [int(n) for n in input().split(' ')]
p = [int(n) for n in input().split(' ')]
q = [int(n) for n in input().split(' ')]
r = [int(n) for n in input().split(' ')]
p.sort()
q.sort()
apple = p[-X:] + q[-Y:] + r
apple.sort()
print((sum(apple[-X-Y:])))
| p02727 |
X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
p.reverse()
q.reverse()
p=p[:X]
q=q[:Y]
r=r[:max(X,Y)]
a=p[:]
a.extend(q)
a.extend(r)
a.sort()
a.reverse()
b=q[:]
b.extend(r)
b.sort()
b.rev... | X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
p.reverse()
q.reverse()
p=p[:X]
q=q[:Y]
a=p[:]
a.extend(q)
a.extend(r)
a.sort()
a.reverse()
sum=0
for i in range(X+Y):
sum+=a[i]
print(sum) | p02727 |
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
eats = sorted(p, reverse=True)[:x] + sorted(q, reverse=True)[:y]
while r and max(r) >= min(eats):
eats[eats.index(min(eats))] = max(r)
r.remove(max... | x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
eats = sorted(p, reverse=True)[:x] + sorted(q, reverse=True)[:y] + r
eats.sort(reverse=True)
print((sum(eats[:x+y]))) | p02727 |
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
d... | #!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
d... | p02727 |
x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r)
p=p[:x]
q=q[:y]
import heapq
from collections import deque
heapq.heapify(p)
heapq.heapify(q)
r=dequ... | x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r)
box=[]
ans=0
for i in range(x):
box.append(p[i])
for j in range(y):
box.append(q[j])... | p02727 |
x, y, a, b, c = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)
all = []
for i in range(x):
all.append(p[i])
for i in range(y):
all.append(q[i])
... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
x, y, a, b, c = list(map(int, input().split()))
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R ... | p02727 |
# -*- coding: utf-8 -*-
#############
# Libraries #
#############
import sys
input = sys.stdin.readline
import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache
#############
# Constants #
#############
M... | # -*- coding: utf-8 -*-
#############
# Libraries #
#############
import sys
input = sys.stdin.readline
import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache
#############
# Constants #
#############
M... | p02727 |
X, Y, A, B, C = list(map(int, input().split()))
p, q, r = [list(map(int, input().split())) for _ in range(3)]
p = list([[x, 'p'] for x in p])
q = list([[x, 'q'] for x in q])
r = list([[x, 'r'] for x in r])
l = p+q+r
l.sort(reverse=True)
x = 0
y = 0
sum = 0
while not (x == X and y == Y):
apple... | X, Y, A, B, C = list(map(int, input().split()))
p, q, r = [list(map(int, input().split())) for _ in range(3)]
p = sorted(p, reverse=True)[:X]
q = sorted(q, reverse=True)[:Y]
l = p+q+r
l.sort(reverse=True)
print((sum(l[:X+Y]))) | p02727 |
import sys
class Heap:
def __init__(self):
self.heap = [None]*1000000
self.root = 0
self.size = 0
def push(self, a:int):
self.heap[self.size] = a
b = self.size
while b != 0 and self.heap[(b - 1) //2] < self.heap[b]:
c = self.heap[(b - 1... | import sys
import heapq
def main():
x, y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
pq = []
heapq.heapify(pq)
p.sort()
q.sort()
for i in range(x):
heapq.he... | p02727 |
from collections import deque
p, q, r = deque, deque, deque
X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
tmp = 0
p.sort(reverse=True)
p.append(0)
q.sort(reverse=True)
q.append(0)
r.sort(reverse=Tr... | X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
tmp = 0
p.sort(reverse=True)
p.append(0)
q.sort(reverse=True)
q.append(0)
r.sort(reverse=True)
r.append(0)
z = X+Y
e, f, g = 0, 0, 0
for i in range(z):... | p02727 |
X,Y,A,B,C = list(map(int, input().split()))
red = list(map(int, input().split()))
green = list(map(int, input().split()))
white = list(map(int, input().split()))
red = sorted(red, reverse=True)[:X]
green = sorted(green, reverse=True)[:Y]
ans = sum(red) + sum(green)
white = sorted(white, reverse=True)
while ... | X,Y,A,B,C = list(map(int, input().split()))
red = list(map(int, input().split()))
green = list(map(int, input().split()))
white = list(map(int, input().split()))
red = sorted(red, reverse=True)[:X]
green = sorted(green, reverse=True)[:Y]
ans = sum(red) + sum(green)
white = sorted(white, reverse=True)
for i ... | p02727 |
x, y, a, b, c = list(map(int, input().split()))
red = sorted(int(x) for x in input().split())[-x:]
green = sorted(int(x) for x in input().split())[-y:]
print((sum(sorted([int(x) for x in input().split()] + red + green)[-(x+y):])))
| x, y, a, b, c = list(map(int, input().split()))
red = [int(x) for x in input().split()]
green = [int(x) for x in input().split()]
red.sort(reverse=True)
green.sort(reverse=True)
candidates = [int(x) for x in input().split()] + red[:x] + green[:y]
candidates.sort(reverse=True)
print((sum(candidates[:x+y]))) | p02727 |
x, y, a, b, c = list(map(int, input().split()))
red = [int(x) for x in input().split()]
green = [int(x) for x in input().split()]
red.sort()
green.sort()
candidates = [int(x) for x in input().split()] + red[-x:] + green[-y:]
candidates.sort()
print((sum(candidates[-x-y:]))) | x, y, a, b, c = list(map(int, input().split()))
red = [int(x) for x in input().split()]
green = [int(x) for x in input().split()]
red.sort(reverse=True)
green.sort(reverse=True)
candidates = [int(x) for x in input().split()] + red[:x] + green[:y]
candidates.sort(reverse=True)
print((sum(candidates[:x+y]))) | p02727 |
x, y, a, b, c = list(map(int, input().split()))
red = [int(x) for x in input().split()]
green = [int(x) for x in input().split()]
red.sort(reverse=True)
green.sort(reverse=True)
candidates = [int(x) for x in input().split()] + red[:x] + green[:y]
candidates.sort(reverse=True)
print((sum(candidates[:x+y]))) | x, y, a, b, c = list(map(int, input().split()))
print((sum(sorted(
sorted(int(x) for x in input().split())[-x:] +
sorted(int(x) for x in input().split())[-y:] +
[int(x) for x in input().split()])[-(x+y):]))) | p02727 |
X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse = True)
q.sort(reverse = True)
r.sort()
p = p[:X]
a = q[:Y] + p
z = []
a.sort(reverse = True)
while len(a) != 0 and len(r) != 0 and ... | X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse = True)
q.sort(reverse = True)
ans = p[:X] + q[:Y] + r
ans.sort(reverse = True)
print((sum(ans[:X+Y]))) | p02727 |
x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=True)
q=sorted(list(map(int,input().split())),reverse=True)
r=sorted(list(map(int,input().split())),reverse=True)
p2=p[:x]
q2=q[:y]
memop=x-1
memoq=y-1
sp=sum(p2)
sq=sum(q2)
k=0
flagp=0
flagq=0
while k<c:
if memop... | x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=True)
q=sorted(list(map(int,input().split())),reverse=True)
r=sorted(list(map(int,input().split())),reverse=True)
p2=p[:x]
q2=q[:y]
memop=x-1
memoq=y-1
sp=sum(p2)
sq=sum(q2)
k=0
flagp=0
flagq=0
while k<c:
if memop... | p02727 |
from collections import deque
X, Y, A, B, C = list(map(int, input().split()))
P = [int(n) for n in input().split()]
Q = [int(n) for n in input().split()]
R = [int(n) for n in input().split()]
P.sort()
Q.sort()
R.sort(reverse=True)
PQ = deque(sorted(P[-X:] + Q[-Y:]))
R = deque(R)
while True:
if no... | from collections import deque
X, Y, A, B, C = list(map(int, input().split()))
P = [int(n) for n in input().split()]
Q = [int(n) for n in input().split()]
R = [int(n) for n in input().split()]
P.sort()
Q.sort()
R.sort(reverse=True)
PQ = deque(sorted(P[-X:] + Q[-Y:]))
R = deque(R)
while True:
if no... | p02727 |
X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
tmp=sorted(p)
P=tmp[::-1]
tmp=sorted(q)
Q=tmp[::-1]
tmp=sorted(r)
R=tmp[::-1]
ans=0
while(1):
if X==0 and Y==0:
print(ans)
break
elif X>0 and Y>0:
tmp=max(P... | X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
tmp=sorted(p)
P=tmp[::-1]
tmp=sorted(q)
Q=tmp[::-1]
tmp=sorted(r)
R=tmp[::-1]
tmp=P[:X]+Q[:Y]+R
tmp=sorted(tmp)
tmp=tmp[::-1]
ans=sum(tmp[:X+Y])
print(ans)
| p02727 |
from heapq import heappush, heappop, heapify
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
# print(p)
# print(q)
# print(r)
ar = p... | x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r += p[:x]
r += q[:y]
r.sort(reverse=True)
ans = sum(r[:x + y])
print(ans)
| p02727 |
X,Y,A,B,C=list(map(int,input().split()))
p=sorted(list(map(int,input().split())))[::-1][:X]
q=sorted(list(map(int,input().split())))[::-1][:Y]
r=sorted(list(map(int,input().split())))[::-1]
pq=sorted(p+q)
for R in r:
for i in range(len(pq)):
if pq[i]<R:
pq[i]=R
break
print(... | X,Y,A,B,C=list(map(int,input().split()))
p=sorted(list(map(int,input().split())))[::-1][:X]
q=sorted(list(map(int,input().split())))[::-1][:Y]
r=list(map(int,input().split()))
ans=sorted(p+q+r)[::-1][:X+Y]
print((sum(ans))) | p02727 |
def main():
import bisect
x,y,a,b,c = list(map(int,input().split()))
p = sorted(list(map(int,input().split())))[-1*x:]
q = sorted(list(map(int,input().split())))[-1*y:]
r = sorted(list(map(int,input().split())),reverse=True)
for i in range(c):
if p[0]>=q[0]:
if q[0]<r... | def main():
import bisect
x,y,a,b,c = list(map(int,input().split()))
p = sorted(list(map(int,input().split())))[-1*x:]
q = sorted(list(map(int,input().split())))[-1*y:]
r = sorted(list(map(int,input().split())))
ans = p+q+r
ans = sorted(ans,reverse=True)[0:x+y]
print((sum(ans)))
... | p02727 |
x, y, a, b, c = [int(t) for t in input().split()]
p = [int(t) for t in input().split()]
q = [int(t) for t in input().split()]
r = [int(t) for t in input().split()]
s = []
for i in range(x):
p_max = max(p)
if r:
r_max = max(r)
else:
r_max = 0
if p_max >= r_max:
s.appen... | x, y, a, b, c = [int(t) for t in input().split()]
p = [int(t) for t in input().split()]
q = [int(t) for t in input().split()]
r = [int(t) for t in input().split()]
s = []
p.sort(reverse=True)
p = p[:x]
q.sort(reverse=True)
q = q[:y]
s = p + q + r
s.sort(reverse=True)
s = s[:x+y]
print((sum(s))) | p02727 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-*-
from sys import stdin
def main():
X, Y, A, B, C = list(map(int, stdin.readline().split()))
p = list(map(int, stdin.readline().split()))
q = list(map(int, stdin.readline().split()))
r = list(map(int, stdin.readline().split()))
p.sort(re... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-*-
from sys import stdin
def main():
X, Y, A, B, C = list(map(int, stdin.readline().split()))
p = list(map(int, stdin.readline().split()))
q = list(map(int, stdin.readline().split()))
r = list(map(int, stdin.readline().split()))
p.sort(re... | p02727 |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
INF = 10 ** 10
MOD = 10 ** 9 + 7
from heapq import heapify,heappop,heappush
input = sys.stdin.readline
def main():
x,y,a,b,c = list(map(int,input().split()))
R = list(map(int,input().split()))
G = list(map(int,input().split()... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
INF = 10 ** 10
MOD = 10 ** 9 + 7
from heapq import heapify,heappop,heappush
input = sys.stdin.readline
def main():
x,y,a,b,c = list(map(int,input().split()))
R = list(map(int,input().split()))
G = list(map(int,input().split()... | p02727 |
def main():
from collections import deque
X, Y, A, B, C = list(map(int, input().split()))
*p, = sorted(map(int, input().split()), reverse=True)
*q, = sorted(map(int, input().split()), reverse=True)
*r, = sorted(map(int, input().split()), reverse=True)
p = deque(p[:X])
q = deque(q[... | def main():
X, Y, A, B, C = list(map(int, input().split()))
*p, = sorted(map(int, input().split()), reverse=True)
*q, = sorted(map(int, input().split()), reverse=True)
*r, = list(map(int, input().split()))
pool = p[:X] + q[:Y] + r
pool.sort(reverse=True)
ret = sum(pool[:X + Y])
... | p02727 |
x, y, a, b, c = list(map(int, input().split()))
*p, = list(map(int, input().split()))
*q, = list(map(int, input().split()))
*r, = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
pool = p[:x] + q[:y] + r
pool.sort(reverse=True)
pool = pool[:x + y]
ans = sum(pool)
print(ans)
| def main():
X, Y, A, B, C = list(map(int, input().split()))
*P, = list(map(int, input().split()))
*Q, = list(map(int, input().split()))
*R, = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
ans = sum(sorted(P[:X] + Q[:Y] + R, reverse=True)[:X + Y])
p... | p02727 |
import heapq
x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
ri=sorted(r)[::-1]
qi=q[::]
pi=p[::]
if x>a:
pi+=ri[:x-a]
ri=ri[x-a:]
if y>b:
qi+=ri[:y-b]
ri=ri[y-b:]
pi=sorted(pi)[::-1]
pi=pi[:... | x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
ri=sorted(r)[::-1]
qi=q[::]
pi=p[::]
pi=sorted(pi)[::-1]
pi=pi[:x]
qi=sorted(qi)[::-1]
qi=qi[:y]
l=pi+qi
l=sorted(l)
k=0
for i in range(min(c,x+y)):
if l[i... | p02727 |
x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p2 = p[:x]
q2 = q[:y]
for i in range(c):
if p2[-1] <= q2[-1] and p2[-1] < r[i]:
p2[-1]... | x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
p2 = p[:x]
q2 = q[:y]
l = p2 + q2 + r
l.sort(reverse=True)
ans = sum(l[:x+y])
print(ans) | p02727 |
X,Y,A,B,C = list(map(int,input().split()))
p = sorted(list(map(int,input().split()))) #A
q = sorted(list(map(int,input().split()))) #B
r = sorted(list(map(int,input().split()))) #C
xlist = p[-X:] #X
ylist = q[-Y:] #Y
def main(X,Y,xlist,ylist,r):
for i in range(min(X,Y)):
if xlist[i] < ylist[i]... | X,Y,A,B,C = list(map(int,input().split()))
p = sorted(list(map(int,input().split()))) #A
q = sorted(list(map(int,input().split()))) #B
r = sorted(list(map(int,input().split()))) #C
xlist = p[-X:] #X
ylist = q[-Y:] #Y
"""
def main(X,Y,xlist,ylist,r):
for i in range(min(X,Y)):
if xlist[i] < yli... | p02727 |
# coding: utf-8
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
ans = 0
L = P[:X] + Q[:Y]
L.sort()
idx = 0
for i in range(X+Y):
if i... | # coding: utf-8
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=False)
ans = 0
L = P[:X] + Q[:Y] + R
L.sort(reverse=True)
print((sum(L[:X+Y]))) | p02727 |
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [lis... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [lis... | p02727 |
# -*- coding: utf-8 -*-
import sys
from heapq import heapify, heappop, heappush
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d f... | # -*- coding: utf-8 -*-
import sys
from heapq import heapify, heappop, heappush
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d f... | p02727 |
X, Y, A, B, C = list(map(int, input().split(' ')))
apples = []
for p in map(int, input().split(' ')):
apples.append((p, 0))
for q in map(int, input().split(' ')):
apples.append((q, 1))
for r in map(int, input().split(' ')):
apples.append((r, 2))
apples.sort(reverse=True)
pq = []
r = []
... | X, Y, A, B, C = list(map(int, input().split(' ')))
P = sorted(list(map(int, input().split(' '))), reverse=True)[:X]
Q = sorted(list(map(int, input().split(' '))), reverse=True)[:Y]
R = sorted(list(map(int, input().split(' '))), reverse=True)
apples = sorted(P + Q + R, reverse=True)[:X + Y]
print((sum(apples)... | p02727 |
X,Y,A,B,C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p = sorted(p)
q = sorted(q)
r = sorted(r)
P = A - X
Q = B - Y
R = C - 1
found = True
while R >= 0:
if P < A:
if (r[R] >= p[P]):
if (q[... | X,Y,A,B,C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p = sorted(p)
q = sorted(q)
r = sorted(r)
P = A - X
Q = B - Y
R = C - 1
found = True
for i in range(C+1):
if R < 0:
break
if P < A:
i... | p02727 |
x, y, a, b, c = list(map(int, input().split()))
arrayP = list(map(int, input().split()))
arrayQ = list(map(int, input().split()))
arrayR = list(map(int, input().split()))
arrayP.sort(reverse=True)
arrayQ.sort(reverse=True)
arrayR.sort(reverse=True)
arrayAns = []
for i in range(x):
arrayAns.append(int(array... | x, y, a, b, c = list(map(int, input().split()))
arrayP = list(map(int, input().split()))
arrayQ = list(map(int, input().split()))
arrayR = list(map(int, input().split()))
arrayP.sort(reverse=True)
arrayQ.sort(reverse=True)
arrayR.sort(reverse=True)
arrayAns = []
for i in range(x):
arrayAns.append(int(array... | p02727 |
import heapq
x, y, a, b, c = list(map(int, input().split()))
pp = list([(-int(x), 1) for x in input().split()])
qq = list([(-int(x), 2) for x in input().split()])
rr = list([(-int(x), 3) for x in input().split()])
xx = pp + qq + rr
heapq.heapify(xx)
t = x + y
ans = 0
for _ in range(t):
while len(xx) >... | x, y, a, b, c = list(map(int, input().split()))
pp = list(sorted(map(int, input().split()), reverse=True))[:x]
qq = list(sorted(map(int, input().split()), reverse=True))[:y]
rr = list(map(int, input().split()))
xx = list(sorted(pp + qq + rr, reverse=True))[:x+y]
print((sum(xx)))
| p02727 |
import heapq
X, Y, A, B, C= list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort(reverse=True)
P = P[:X]
Q = list(map(int, input().split()))
Q.sort(reverse=True)
Q = Q[:Y]
R = list(map(int, input().split()))
R.sort(reverse=True)
colored = []
for r in R:
p_min = P[-1]
q_min =... | import heapq
X, Y, A, B, C= list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort(reverse=True)
P = P[:X]
heapq.heapify(P)
Q = list(map(int, input().split()))
Q.sort(reverse=True)
Q = Q[:Y]
heapq.heapify(Q)
R = list(map(int, input().split()))
R.sort(reverse=True)
for r in R:
p_mi... | p02727 |
X,Y,A,B,C = list(map(int, input().split()))
P=sorted(list(map(int,input().split())), reverse=True)
Q=sorted(list(map(int,input().split())), reverse=True)
R=sorted(list(map(int,input().split())), reverse=True)
a=[0]
b=[0]
c=[0]
for i in P[:X]:
a.append(a[-1]+i)
for i in Q[:Y]:
b.append(b[-1]+... | X,Y,A,B,C = list(map(int, input().split()))
P=sorted(list(map(int,input().split())), reverse=True)
Q=sorted(list(map(int,input().split())), reverse=True)
R=sorted(list(map(int,input().split())), reverse=True)
C = P[:X] + Q[:Y] + R
C.sort(reverse=True)
print((sum(C[:X+Y])))
| p02727 |
import sys
input = sys.stdin.buffer.readline
import heapq
def main():
X,Y,A,B,C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.sort()
p = p[-X:]
q = q[-Y:]
... | import sys
input = sys.stdin.buffer.readline
def main():
X,Y,A,B,C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.sort()
p = p[-X:]
q = q[-Y:]
use = p+q+r
... | p02727 |
X,Y,A,B,C = [int(i) for i in input().split()]
def input_list(N):
list = []
for i in input().split():
list.append(int(i))
list.sort(reverse=True)
return list
P = input_list(A)
Q = input_list(B)
R = input_list(C)
def delete_last(list,X):
for i in range(X,len(list)):
list.pop(X)
dele... | X,Y,A,B,C = [int(i) for i in input().split()]
def input_list(N):
list = []
for i in input().split():
list.append(int(i))
list.sort(reverse=True)
return list
P = input_list(A)
Q = input_list(B)
R = input_list(C)
Top = P[:X] + Q[:Y] + R
Top.sort(reverse=True)
sum = 0
for i in range(X+Y):
s... | p02727 |
import sys
input = sys.stdin.readline
x,y,a,b,c = list(map(int,input().split()))
pl = list(map(int,input().split()))
ql = list(map(int,input().split()))
rl = list(map(int,input().split()))
pl = sorted(pl)
ql = sorted(ql)
rl = sorted(rl)
import itertools
pl_ac = [0] + list(itertools.accumulate(pl))
ql_a... | x,y,a,b,c = list(map(int,input().split()))
pl = list(map(int,input().split()))
ql = list(map(int,input().split()))
rl = list(map(int,input().split()))
pl = sorted(pl)
ql = sorted(ql)
rl = sorted(rl)
ansl = pl[-x:] + ql[-y:]
ansl += rl
ansl = sorted(ansl)
print((sum(ansl[-(x+y):])))
| p02727 |
X, Y, A, B, C = list(map(int, input().split()))
Ap = list([(int(x), 0) for x in input().split()])
Bq = list([(int(x), 1) for x in input().split()])
Cr = list([(int(x), 2) for x in input().split()])
INF = 2 * 10**5 + 1
L = Ap + Bq + Cr
L.sort(reverse = True)
cnt = [0, 0, 0]
cntM = [X, Y, INF]
s = 0
ans... | X, Y, A, B, C = list(map(int, input().split()))
Ap = list(map(int, input().split()))
Bq = list(map(int, input().split()))
Cr = list(map(int, input().split()))
Ap.sort(reverse = True)
Bq.sort(reverse = True)
L = sorted(Ap[:X] + Bq[:Y] + Cr, reverse = True)
print((sum(L[:X+Y]))) | p02727 |
x, y, a, b, c = list(map(int, input().split()))
arrayP = list(map(int, input().split()))
arrayQ = list(map(int, input().split()))
arrayR = list(map(int, input().split()))
arrayP.sort(reverse=True)
arrayQ.sort(reverse=True)
arrayR.sort(reverse=True)
arrayAns = []
for i in range(x):
arrayAns.append(int(array... | X,Y,A,B,C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
hoge=p[:X]+q[:Y]+r
hoge.sort(reverse=True)
print((sum(hoge[:X+Y])))
| p02727 |
x, y, a, b, c = list(map(int, input().split()))
p = sorted(list(map(int, input().split())),reverse = True)
q = sorted(list(map(int, input().split())),reverse = True)
r = sorted(list(map(int, input().split())),reverse = True)
ans = 0
while (p[0] > r[0]):
ans += p.pop(0)
x -= 1
if (x == 0):
... | x, y, a, b, c = list(map(int, input().split()))
p = sorted(list(map(int, input().split())),reverse = True)
q = sorted(list(map(int, input().split())),reverse = True)
r = sorted(list(map(int, input().split())),reverse = True)
px = p[:x]
qx = q[:y]
aps = sorted(px + qx + r, reverse=True)
print((sum(aps[0:x+y... | p02727 |
#n,x,y=map(int,input())
# Queue
x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
p=p[a-x:]
q=q[b-y:]
r.sort()
for ri in r:
if ri > p[0] and q[0] >= p[0]:
p[0] = ri
p.sort()
... |
x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
p=p[:x]
q=q[:y]
p[x:x]=q
p[x+y:x+y]=r
p.sort(reverse=True)
p=p[:x+y]
print((sum(p))) | p02727 |
x,y,a,b,c=list(map(int,input().split()))
p=list([['red',int(x)] for x in input().split()])
q=list([['green',int(x)] for x in input().split()])
r=list([['nan',int(x)] for x in input().split()])
p.sort(key=lambda x:x[1])
p=p[-x:]
q.sort(key=lambda x:x[1])
q=q[-y:]
p[len(p):len(p)]=q
p[len(p):len(p)]=r
p.sort(ke... | x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
p=p[-x:]
q.sort()
q=q[-y:]
p[len(p):len(p)]=q
p[len(p):len(p)]=r
p.sort()
p=p[-x-y:]
print((sum(p))) | p02727 |
x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
p=p[-x:]
q.sort()
q=q[-y:]
p[len(p):len(p)]=q
p[len(p):len(p)]=r
p.sort()
p=p[-x-y:]
print((sum(p))) | x,y,nr,ng,nm=list(map(int,input().split()))
r=list(map(int,input().split()))
g=list(map(int,input().split()))
m=list(map(int,input().split()))
r.sort(reverse=True)
g.sort(reverse=True)
a=r[:x]+g[:y]+m
a.sort(reverse=True)
print((sum(a[:x+y])))
| p02727 |
X, Y, R, G, N = list(map(int, input().split()))
r = [int(x) for x in input().split()]
g = [int(x) for x in input().split()]
n = [int(x) for x in input().split()]
r = sorted(r)[R-X:]
g = sorted(g)[G-Y:]
n = sorted(n, reverse=True)
nr = 0; ng = 0; nn = 0
for i in range(N):
if n[nn] <= min(r[nr], g[ng]):
... | X, Y, R, G, N = list(map(int, input().split()))
r = [int(x) for x in input().split()]
g = [int(x) for x in input().split()]
n = [int(x) for x in input().split()]
r = sorted(r)[R-X:]
g = sorted(g)[G-Y:]
apple = r + g + n
apple = sorted(apple)[len(apple)-(X+Y):]
print((sum(apple))) | p02727 |
x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
ans=0
z=x+y
while(z!=0):
while((x!=0)and(y!=0)):
a=[]
a.append(p[0])
... | x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
r.sort()
ans=0
z=x+y
while(z!=0):
while((x!=0)and(y!=0)):
a=[]
a.append(p[-1])
a.append(q[-1])
... | p02727 |
import sys
import heapq
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X,Y,A,B,C = list(map(int, readline().split()))
P = list(map(int, readline().split()))
Q = list(map(int, readline().split()))
R = list(map(int, readline().split()))
P = sorted... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X,Y,A,B,C = list(map(int, readline().split()))
P = sorted(list(map(int, readline().split())),reverse=True)
Q = sorted(list(map(int, readline().split())),reverse=True)
R = sorted(list(map(int, r... | p02727 |
x,y,a,b,c = list(map(int,input().split()))
p = input().split()
p = [int(s) for s in p]
q = input().split()
q = [int(s) for s in q]
r = input().split()
r = [int(s) for s in r]
reds = sorted(p,reverse=True)
reds = reds[:x]
greens = sorted(q,reverse=True)
greens = greens[:y]
r = sorted(r,reverse=True)
while le... | x,y,a,b,c = list(map(int,input().split()))
p = input().split()
p = [int(s) for s in p]
q = input().split()
q = [int(s) for s in q]
r = input().split()
r = [int(s) for s in r]
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
s = p[:x] + q[:y] + r
s.sort(reverse=True)
print((sum(s[:x+y]))) | p02727 |
import sys
input = sys.stdin.readline
import heapq
X, Y, A, B, C = list(map(int, input().split()))
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
red = p[:X]
green = q[:... | import sys
input = sys.stdin.readline
X, Y, A, B, C = list(map(int, input().split()))
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
p.sort(reverse = True)
q.sort(reverse = True)
red = p[:X]
green = q[:Y]
ans = red + green + r
ans.sort(reve... | p02727 |
(x,y,a,b,c),*t=[list(map(int,t.split()))for t in open(0)]
s=sorted
p,q,r=list(map(s,t))
print((sum(s(p[-x:]+q[-y:]+r)[-x-y:]))) | (x,y,*_),*t=[list(map(int,t.split()))for t in open(0)]
s=sorted
p,q,r=list(map(s,t))
print((sum(s(p[-x:]+q[-y:]+r)[-x-y:]))) | p02727 |
x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.sort()
ans = 0
cnt = 0
while x+y-cnt > 0:
if x > 0:
p1 = p[-1]
else:
p1 = 0
if y > 0:
p2 = q[... | x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.sort()
ans = p[a-x:]+q[b-y:]+r
ans.sort()
print((sum(ans[c:])))
| p02727 |
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
PR = sorted(P + R, reverse = True)
QR = sorted(Q + R, reverse = True)
ans = 0
for i in range(X):
ans += PR[i]
if PR[i] in R:
if PR[i] in QR:
... | X, Y, A, B, C = list(map(int, input().split()))
P = sorted(list(map(int, input().split())), reverse = True)
Q = sorted(list(map(int, input().split())), reverse = True)
R = list(map(int, input().split()))
P = P[:X]
Q = Q[:Y]
D = P + Q + R
D = sorted(D, reverse = True)
print((sum(D[:(X + Y)]))) | p02727 |
from collections import deque
x,y,a,b,c=list(map(int, input().split()))
pi=list(map(int,input().split()))
qi=list(map(int,input().split()))
ri=list(map(int,input().split()))
pi.sort(reverse=True)
qi.sort(reverse=True)
ri.sort(reverse=True)
ri=deque(ri)
apple=pi[:x]+qi[:y]
apple.sort(reverse=True)
apple=d... | from collections import deque
x,y,a,b,c=list(map(int, input().split()))
pi=list(map(int,input().split()))
qi=list(map(int,input().split()))
ri=list(map(int,input().split()))
pi.sort(reverse=True)
qi.sort(reverse=True)
apple=pi[:x]+qi[:y]+ri
apple.sort(reverse=True)
print((sum(apple[:x+y]))) | p02727 |
import heapq
import sys
from itertools import accumulate
from collections import defaultdict
input = sys.stdin.readline
def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
... | from collections import defaultdict
def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
d_p = defaultdict(int)
d_q = defaultdict(int)
d_r = defaultdict(int)
for ... | p02727 |
x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())))[-x:]
q=sorted(list(map(int,input().split())))[-y:]
r=sorted(list(map(int,input().split())))
for i in range(len(p)):
r.append(p[i])
for i in range(len(q)):
r.append(q[i])
r=sorted(r)[-x-y:]
print((sum(r)))
| x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())))[-x:]
q=sorted(list(map(int,input().split())))[-y:]
print((sum(sorted(list(map(int,input().split()))+p+q)[-x-y:]))) | p02727 |
import heapq
xi = 0
yi = 0
zi = 0
def next(i):
global xi, yi, zi, p, q, r
if i == 0:
xi += 1
return heapq.nlargest(xi, p)[-1]
elif i == 1:
yi += 1
return heapq.nlargest(yi, q)[-1]
else:
zi += 1
return heapq.nlargest(zi, r)[-1]
x, y, a, b... | import heapq
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p2 = heapq.nlargest(x, p)
q2 = heapq.nlargest(y, q)
r2 = heapq.nlargest(x+y, r)
p2.append(0)
q2.append(0)
r2.append(0)
pi = 0
qi = 0
... | p02727 |
from bisect import bisect_left, insort_left
from collections import deque
import sys
def main():
readlines = sys.stdin.readline
x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.s... | x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.sort(reverse=True)
p = p[a-x:]
q = q[b-y:]
p.extend(q)
p.sort()
ans = sum(p)
count = 0
for i in range(c):
if p[i] < r[i]:
an... | p02727 |
import sys
input=sys.stdin.readline
x,y,a,b,c=list(map(int,input().split()))
a_list=list(map(int,input().split()))
a_list=sorted(a_list)
b_list=list(map(int,input().split()))
b_list=sorted(b_list)
a_list=a_list[-x:]
b_list=b_list[-y:]
c_list=list(map(int,input().split()))
for i in range(c):
c_list[i]=-... | x,y,a,b,c=list(map(int,input().split()))
a_list=list(map(int,input().split()))
a_list=sorted(a_list)
b_list=list(map(int,input().split()))
b_list=sorted(b_list)
a_list=a_list[-x:]
b_list=b_list[-y:]
c_list=list(map(int,input().split()))
for i in range(c):
c_list[i]=-c_list[i]
import heapq
heapq.heapify... | p02727 |
x, y, a, b, c = list(map(int, input().split()))
Lista = sorted(list(map(int, input().split())), reverse = True)
Listb = sorted(list(map(int, input().split())), reverse = True)
Listc = sorted(list(map(int, input().split())), reverse = True)
if x < a:
del Lista[x:a]
if y < b:
del Listb[y:b]
List = sorted(... | x, y, a, b, c = list(map(int, input().split()))
Lista = sorted(list(map(int, input().split())), reverse = True)
Listb = sorted(list(map(int, input().split())), reverse = True)
Listc = sorted(list(map(int, input().split())), reverse = True)
if x < a:
del Lista[x : a]
if y < b:
del Listb[y : b]
List = sor... | p02727 |
from collections import deque
x,y,a,b,c = list(map(int,input().split()))
p = deque(sorted(list(map(int,input().split()))))
q = deque(sorted(list(map(int,input().split()))))
r = deque(sorted(list(map(int,input().split()))))
ans = deque(maxlen=(x+y))
def insertion(z):
global x,y
if z == p:
x -= 1
els... | x,y,a,b,c = list(map(int,input().split()))
p = sorted(map(int,input().split()), reverse = True)
q = sorted(map(int,input().split()), reverse = True)
r = sorted(map(int,input().split()), reverse = True)
ans = sorted(p[:x]+q[:y]+r,reverse = True)
print((sum(ans[:x+y])))
| p02727 |
import heapq
import sys
X, Y, A, B, C = list(map(int, input().split()))
Av = list(map(int, input().split()))
Bv = list(map(int, input().split()))
Cv = list(map(int, input().split()))
heapq.heapify(Av)
heapq.heapify(Bv)
heapq.heapify(Cv)
for i in range(A-X):
heapq.heappop(Av)
for i in range(B-Y):
hea... | def LI():
return list(map(int, input().split()))
X, Y, A, B, C = LI()
red = LI()
green = LI()
mu = LI()
red.sort(reverse=True)
green.sort(reverse=True)
ans = red[:X]+green[:Y]+mu
ans.sort(reverse=True)
total = 0
for i in range(X+Y):
total += ans[i]
print(total)
| p02727 |
x,y,a,b,c=list(map(int,input().split())) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
s=sorted(p+q+r, reverse=True)
cntr,cntg,ans=0,0,0
for i in range(a+b+c):
if cntr<x and (s[i] in set(p) or s[i] in set(r)):
ans+=s[i]
cntr+=1
... | x,y,a,b,c=list(map(int,input().split())) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)[:x]
q=sorted(q,reverse=True)[:y]
print((sum(sorted(p+q+r, reverse=True)[:x+y]))) | p02727 |
from collections import deque
X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)
p = deque(p)
q = deque(q)
r = deque(r)
ans = 0
MIN = ... | from collections import deque
X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)
cand = sorted(p[:X] + q[:Y] + r, reverse=True)
print((sum(... | p02727 |
x,y,a,b,c = list(map(int,input().split()))
p = sorted(list(map(int,input().split())),reverse=True)
q = sorted(list(map(int,input().split())),reverse=True)
r = sorted(list(map(int,input().split())),reverse=True)
result = sum(p[0:x]) + sum(q[0:y])
red = x-1
green = y-1
colorless = 0
#print(p,q,r)
while colorless... | x,y,a,b,c = list(map(int,input().split()))
p = sorted(list(map(int,input().split())),reverse=True)
q = sorted(list(map(int,input().split())),reverse=True)
r = sorted(list(map(int,input().split())),reverse=True)
apples = p[0:x]+q[0:y]+r
print((sum(sorted(apples,reverse=True)[0:x+y]))) | p02727 |
x,y,a,b,c = list(map(int,input().split()))
p = sorted(list(map(int,input().split())),reverse=True)
q = sorted(list(map(int,input().split())),reverse=True)
r = sorted(list(map(int,input().split())),reverse=True)
ans = 0
for i in range(x,max(-1,x-c-1),-1):
z = c-(x-i)
for j in range(y,max(-1,y-1-z),-1):
a... | x,y,a,b,c = list(map(int,input().split()))
p = sorted(list(map(int,input().split())),reverse=True)[:x]
q = sorted(list(map(int,input().split())),reverse=True)[:y]
r = list(map(int,input().split()))
print((sum(sorted(p+q+r,reverse=True)[:(x+y)]))) | p02727 |
x,y,A,B,C=list(map(int,input().split()))
R=list(map(int,input().split()))
G=list(map(int,input().split()))
N=list(map(int,input().split()))
arr=[]
for i in range(A):
arr.append([R[i],-1])
for i in range(B):
arr.append([G[i],-2])
for i in range(C):
arr.append([N[i],-3])
arr.sort(reverse=True)... | import sys
x,y,A,B,C=list(map(int,sys.stdin.readline().split()))
R=list(map(int,sys.stdin.readline().split()))
G=list(map(int,sys.stdin.readline().split()))
N=list(map(int,sys.stdin.readline().split()))
arr=[]
for i in range(A):
arr.append([R[i],-1])
for i in range(B):
arr.append([G[i],-2])
for i in... | p02727 |
from heapq import heapify, heappop, heappush
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
r = [-x for x in r]
p.sort()
q.sort()
r.sort()
p = p[-x:]
q = q[-y:]
heapify(p)
heapify(q)
heapi... | from heapq import heapify, heappop, heappush
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
r = [-x for x in r]
p.sort()
q.sort()
r.sort()
p = p[-x:]
q = q[-y:]
heapify(p)
heapify(q)
heapi... | p02727 |
X,Y,A,B,C = list(map(int, input().split()))
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
newp = p[:X]
newq = q[:Y]
lis = newp + newq
lis.sort(reverse = True)
s = sum(lis)
... | #X,Y,A,B,C = map(int, input().split())
#p = [int(x) for x in input().split()]
#q = [int(x) for x in input().split()]
#r = [int(x) for x in input().split()]
#p.sort(reverse = True)
#q.sort(reverse = True)
#r.sort(reverse = True)
#newp = p[:X]
#newq = q[:Y]
#lis = newp + newq
#lis.sort(reverse = True)
#s = sum... | p02727 |
X,Y,A,B,C=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=True)
q=sorted(list(map(int,input().split())),reverse=True)
r=sorted(list(map(int,input().split())),reverse=True)
i=X-1
j=Y-1
k=0
ans=sum(p[:X])+sum(q[:Y])
while k<len(r):
if i>-1 and j>-1:
if p[i]<q[j]:... | X,Y,A,B,C=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=True)
q=sorted(list(map(int,input().split())),reverse=True)
r=sorted(list(map(int,input().split())),reverse=True)
pqr=sorted(p[:X]+q[:Y]+r,reverse=True)
print((sum(pqr[:(X+Y)]))) | p02727 |
X, Y, A, B, C = list(map(int, input().split()))
P = [int(a) for a in input().split()]
Q = [int(a) for a in input().split()]
R = [int(a) for a in input().split()]
S = sorted([p * 4 for p in P] + [q * 4 + 1 for q in Q] + [r * 4 + 2 for r in R])[::-1]
Z = X + Y
ans = 0
for s in S:
a, t = s>>2, s & 3
if ... | I = lambda: sorted([int(a) for a in input().split()])[::-1]
X, Y, *_ = list(map(int, input().split()))
print((sum(sorted(I()[:X] + I()[:Y] + I())[::-1][:X+Y]))) | p02727 |
X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int,input().split())), reverse=True)[:X]
q = sorted(list(map(int,input().split())), reverse=True)[:Y]
r = sorted(list(map(int,input().split())), reverse=True)
for i in r:
p_min = p[X - 1]
q_min = q[Y - 1]
if p_min > i and q_... | X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int,input().split())), reverse=True)[:X]
q = sorted(list(map(int,input().split())), reverse=True)[:Y]
r = sorted(list(map(int,input().split())), reverse=True)
colored_p = []
colored_q = []
for i in r:
p_min = p[len(p) - 1] if len(p)... | p02727 |
X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse = True)
q = sorted(list(map(int, input().split())), reverse = True)
r = sorted(list(map(int, input().split())), reverse = True)
S = sorted(p[:X] + q[:Y] + r[:X+Y], reverse = True)
i = 0
ans = 0
a = 0
b = 0
c = 0... | X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse = True)
q = sorted(list(map(int, input().split())), reverse = True)
r = sorted(list(map(int, input().split())), reverse = True)
S = sorted(p[:X] + q[:Y] + r[:X+Y], reverse = True)
print((sum(S[:X+Y]))) | p02727 |
import collections
x,y,aa,bb,cc = list(map(int,input().split(' ')))
aas = list(map(int, input().split(' ')))
bbs = list(map(int, input().split(' ')))
ccs = list(map(int, input().split(' ')))
aas.sort(key = lambda x:-x)
bbs.sort(key = lambda x:-x)
ccs.sort(key = lambda x:-x)
aas = aas[:x]
bbs = bbs[:y]
r... | x,y,_,_,_ = list(map(int,input().split(' ')))
a,b,c = list(map(int, input().split(' '))),list(map(int, input().split(' '))),list(map(int, input().split(' ')))
a.sort(key = lambda x:-x)
b.sort(key = lambda x:-x)
c.sort(key = lambda x:-x)
r = a[:x] + b[:y]
r.sort()
i,j = 0,0
while(j < len(c) and i < len(r)):
... | p02727 |
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
temp = P[:X] + Q[:Y]
temp.sort()
ans = sum(temp)
for ri in R:
if temp[0] < ri:
... | X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
temp = P[:X] + Q[:Y] + R
temp.sort(reverse=True)
ans = sum(temp[:X+Y])
print(ans) | p02727 |
import heapq
x, y, a, b, c = list(map(int, input().split()))
ps = sorted(list(map(int, input().split())), reverse=True)[:x]
qs = sorted(list(map(int, input().split())), reverse=True)[:y]
rs = sorted(list(map(int, input().split())))
apples = ps + qs
heapq.heapify(apples)
m = heapq.heappop(apples)
M = rs.pop()
w... | x, y, a, b, c = list(map(int, input().split()))
ps = sorted(list(map(int, input().split())), reverse=True)[:x]
qs = sorted(list(map(int, input().split())), reverse=True)[:y]
rs = list(map(int, input().split()))
apples = sorted(ps + qs + rs, reverse=True)
print((sum(apples[:x+y])))
| p02727 |
import heapq
def main():
X, Y, A, B, C = list(map(int, input().split(' ')))
P = list(map(int, input().split(' ')))
Q = list(map(int, input().split(' ')))
R = list(map(int, input().split(' ')))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
que = []
for p... | def main():
X, Y, A, B, C = list(map(int, input().split(' ')))
P = list(map(int, input().split(' ')))
Q = list(map(int, input().split(' ')))
R = list(map(int, input().split(' ')))
P.sort(reverse=True)
Q.sort(reverse=True)
R = R + P[:X] + Q[:Y]
R.sort(reverse=True)
print((sum... | p02727 |
from heapq import heappush, heappop
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
hp = []
for e in p:
heappush(hp, [-e, 0])
for e in q:
heappush(hp, [-e, 1])
for e in r:
heappush(hp, ... | x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
apples = p[:x] + q[:y] + r
apples.sort(reverse=True)
ans = sum(apples[:x+y])
print(ans)
| p02727 |
def main():
x, y, a, b, c = list(map(int, input().split()))
al = sorted(list(map(int, input().split())), reverse=True)[:x]
bl = sorted(list(map(int, input().split())), reverse=True)[:y]
cl = sorted(list(map(int, input().split())), reverse=True)
ans = 0
xi, yi = 0, 0
for i in cl:
... | def main():
x, y, a, b, c = list(map(int, input().split()))
p = list(sorted(list(map(int, input().split())), reverse=True))[:x]
q = list(sorted(list(map(int, input().split())), reverse=True))[:y]
r = list(map(int, input().split()))
print((sum(list(sorted(p+q+r, reverse=True))[:(x+y)])))
if __n... | p02727 |
X,Y,A,B,C = list(map(int,input().split()))
p,q,r = [sorted(map(int,input().split()),reverse=True) for i in range(3)]
ans,temp = 0,0
for i in range(X+1):
temp = sum([p[t] for t in range(i)])
for j in range(Y+1):
temp_2 = temp + sum([q[t] for t in range(j)])
t = lambda C: X-i+Y-j if X+Y-i... | X,Y,A,B,C = list(map(int,input().split()))
p,q,r = [sorted(map(int,input().split()),reverse=True) for i in range(3)]
ans = 0
pp,qq = [p[i] for i in range(X)] ,[q[i] for i in range(Y)]
r = r + pp + qq
r = sorted(r,reverse=True)
for i in range(X+Y):
ans += r[i]
print(ans) | p02727 |
#coding:utf-8
x, y, a, b, c = list(map(int, input().split()))
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
def pick(list1,list2,number):
list_f = list1.copy()
list_f2 = list1.copy()
list_s = list2.copy()
list_f2.extend(list_... | #coding:utf-8
x, y, a, b, c = list(map(int, input().split()))
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
p.sort(reverse = True)
q.sort(reverse = True)
p = p[0:x]
q = q[0:y]
p.extend(q)
p.extend(r)
p.sort(reverse = True)
ans = 0
... | p02727 |
#!/usr/bin/env python3
import sys
import heapq
sys.setrecursionlimit(10**8)
INF = float("inf")
class MaxHeap(object):
def __init__(self, x, default=-INF):
self.heap = [-e for e in x]
self.default = default
heapq.heapify(self.heap)
def push(self, value):
heapq.hea... | #!/usr/bin/env python3
import sys
import heapq
sys.setrecursionlimit(10**8)
INF = float("inf")
class MaxHeap(object):
def __init__(self, x, default=-INF):
self.heap = [-e for e in x]
self.default = default
heapq.heapify(self.heap)
def push(self, value):
heapq.hea... | p02727 |
from collections import deque
x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
l = p[:x] + q[:y] + r
l.sort(reverse=True)
print((sum(l[:(x+y)]))) | x,y,a,b,c = list(map(int,input().split()))
print((sum(sorted(sorted(list(map(int,input().split())),reverse=True)[:x]+sorted(list(map(int,input().split())),reverse=True)[:y]+list(map(int,input().split())),reverse=True)[:(x+y)]))) | p02727 |
X,Y,A,B,C=list(map(int,input().split()))
p=sorted(map(int,input().split()))
q=sorted(map(int,input().split()))
r=sorted(map(int,input().split()))
ans=[]
ans+=p[A-X:]
ans+=q[B-Y:]
for i in r:
if i>min(ans):
ans.remove(min(ans))
ans.append(i)
print((sum(ans)))
| X,Y,A,B,C=list(map(int,input().split()))
p=sorted(map(int,input().split()))
q=sorted(map(int,input().split()))
r=sorted(map(int,input().split()))
ans=[]
ans+=p[A-X:]
ans+=q[B-Y:]
ans.sort()
j=0
k=0
for i in ans:
if len(r)>1:
k=r[-1]
elif len(r)==1:
k=r[0]
else:
break
if i<k:
ans[j]=r.pop()... | p02727 |
from heapq import heapify, heappush, heappop
def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
... | from heapq import heapify, heappush, heappop
def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
... | p02727 |
from heapq import heapify, heappush, heappop
def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
... | from heapq import heapify, heappush, heappop
def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
PQR = P[:X] + Q[:Y] + R
... | p02727 |
from heapq import heapify, heappush, heappop
def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
PQR = P[:X] + Q[:Y] + R
... | def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
PQR = P[:X] + Q[:Y] + R
PQR.sort(reverse=True)
print((sum(P... | p02727 |
import heapq
X,Y,A,B,C = list(map(int, input().split()))
p = sorted(map(int, input().split()), reverse=True)
q = sorted(map(int, input().split()), reverse=True)
r = sorted(map(int, input().split()), reverse=True)
red = p[:X]
green = q[:Y]
nocolor = r
heapq.heapify(red)
heapq.heapify(green)
# heapq.h... | import heapq
X, Y, A, B, C = list(map(int, input().split()))
p = sorted(map(int, input().split()), reverse=True)
q = sorted(map(int, input().split()), reverse=True)
r = sorted(map(int, input().split()), reverse=True)
red = p[:X]
green = q[:Y]
nocolor = r
heapq.heapify(red)
heapq.heapify(green)
for n... | p02727 |
import heapq
X, Y, A, B, C = list(map(int, input().split()))
p = sorted(map(int, input().split()), reverse=True)
q = sorted(map(int, input().split()), reverse=True)
r = sorted(map(int, input().split()), reverse=True)
red = p[:X]
green = q[:Y]
nocolor = r
heapq.heapify(red)
heapq.heapify(green)
for n... | X, Y, A, B, C = list(map(int, input().split()))
p = sorted(map(int, input().split()), reverse=True)[:X]
q = sorted(map(int, input().split()), reverse=True)[:Y]
r = list(map(int, input().split()))
apples = p + q + r
apples.sort(reverse=True)
print((sum(apples[: X + Y])))
| p02727 |
import heapq
x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=True)[:x]
q=sorted(list(map(int,input().split())),reverse=True)[:y]
r=list(map(int,input().split()))
l=p+q
ans=sum(l)
hq=[]
for i in l:
heapq.heappush(hq,i)
rq=[]
for i in r:
heapq.heappush(rq,-i)
... | x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=True)[:x]
q=sorted(list(map(int,input().split())),reverse=True)[:y]
r=list(map(int,input().split()))
print((sum(sorted(p+q+r,reverse=True)[:x+y]))) | p02727 |
import heapq
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
hq = []
for z in p:
heapq.heappush(hq, [-z, 1])
for z in q:
heapq.heappush(hq, [-z, 2])
for z in r:
heapq.heappush(hq, [-z, 3])
red =... | x, y, a, b, c = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse=True)[:x]
q = sorted(list(map(int, input().split())), reverse=True)[:y]
r = sorted(list(map(int, input().split())), reverse=True)
print((sum(sorted(p + q + r, reverse=True)[:x+y]))) | p02727 |
X, Y, A, B, C = list([int(x) for x in input().split(" ")])
li = []
p = list([int(x) for x in input().split(" ")])
q = list([int(x) for x in input().split(" ")])
r = list([int(x) for x in input().split(" ")])
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p = p[:X]
q = q[:Y]
for j, y in en... | X, Y, A, B, C = list([int(x) for x in input().split(" ")])
li = []
p = list([int(x) for x in input().split(" ")])
q = list([int(x) for x in input().split(" ")])
r = list([int(x) for x in input().split(" ")])
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p = p[:X]
q = q[:Y]
r.extend(p)
r.ex... | p02727 |
import heapq
x,y,a,b,c=list(map(int,input().split()))
def _int(x):
return -int(x)
p=list(map(_int,input().split()))
q=list(map(_int,input().split()))
r=list(map(_int,input().split()))
heapq.heapify(p)
heapq.heapify(q)
heapq.heapify(r)
ans=[]
heapq.heapify(ans)
for i in range(x):
_p=heapq.heappop(... | #heapqすら使わなくても良い
x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=True)[:x]
q=sorted(list(map(int,input().split())),reverse=True)[:y]
r=sorted(list(map(int,input().split())),reverse=True)
p.extend(q)
ans=sorted(p)
#ansは小さい順、rは大きい順
for i in range(x+y):
if len(r)... | p02727 |
from heapq import heappop, heapify, heappush
x, y, a, b, c = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [-i for i in C]
A.sort(reverse=True)
B.sort(reverse=True)
AB = A[:x] + (B[:y])
heapify(AB)
heapify(... | x, y, a, b, c = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
ABC = A[:x] + B[:y] + C
ABC.sort(reverse=True)
print((sum(ABC[:(x+y)]))) | p02727 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.