input
stringlengths
20
127k
target
stringlengths
20
119k
problem_id
stringlengths
6
6
_,*p=list(map(int,open(0)));print((sum(p)-max(p)//2))
N = int(eval(input())) pl = tuple(int(eval(input()))for _ in range(N)) p_mx = max(pl)//2 ans = sum(pl) - p_mx print(ans)
p03207
N = int(eval(input())) p_array = [] for _ in range(N): price = int(eval(input())) p_array.append(price) #合計 price_sum = sum(p_array) #最大値の半分の値(/ではなく//を使用しているのはint型にするため) discount = max(p_array)//2 print((price_sum - discount))
N = int(eval(input())) p_array = [] price_sum = 0 price_max = 0 for _ in range(N): price = int(eval(input())) #都度、足していく price_sum += price #都度、最大値を更新していく price_max = max(price, price_max) print((price_sum - price_max//2))
p03207
# -*- coding: utf-8 -*- def main(): n = int(eval(input())) p = sorted([int(eval(input())) for _ in range(n)]) # See: # https://img.atcoder.jp/abc115/editorial.pdf print((sum(p) - max(p) // 2)) if __name__ == '__main__': main()
# -*- coding: utf-8 -*- def main(): n = int(eval(input())) p = [int(eval(input())) for _ in range(n)] print((sum(p) - max(p) // 2)) if __name__ == '__main__': main()
p03207
n = int(eval(input())) p = [int(eval(input())) for i in range(n)] print((sum(p)-max(p)//2))
n = int(eval(input())) P = [int(eval(input())) for i in range(n)] print((sum(P)-max(P)//2))
p03207
N=int(eval(input())) c=[0]*N for i in range(N): c[i] =int(eval(input())) print((int(sum(c)-max(c)//2)))
ri = lambda: int(eval(input())) rl = lambda: list(map(int,input().split())) N=ri() p=[0]*N for i in range(N): p[i] = ri() print((sum(p)-max(p)//2))
p03207
N = int(eval(input())) P = sorted([int(eval(input())) for x in range(N)]) m = P[N-1] P = P[:N-1] print((sum(P) + m // 2))
N = int(eval(input())) m, *P = sorted([int(eval(input())) for x in range(N)], reverse=True) """ m = P[N-1] P = P[:N-1] """ print((sum(P) + m // 2))
p03207
# coding: utf-8 N = int(eval(input())) p = [ int(eval(input())) for _ in range(N)] m = max(p)//2 p[p.index(max(p))] = 0 print((sum(p)+m))
# coding: utf-8 p = [ int(eval(input())) for _ in range(int(eval(input())))] print((sum(p)-max(p)//2))
p03207
_,*a=list(map(int,open(0).readlines()));print((sum(a)-max(a)//2))
n,*p=list(map(int,open(0).read().split())) print((sum(sorted(p)[:-1])+sorted(p)[-1]//2))
p03207
n = int(eval(input())) nums =[] for i in range(n): nums.append(int(eval(input()))) m = max(nums) nums.remove(m) print((int(sum(nums) + (m / 2))))
N = int(eval(input())) nums = [] for i in range(N): nums.append(int(eval(input()))) m = max(nums) nums.remove(m) print((int(sum(nums) + (m / 2))))
p03207
x = sorted([int(eval(input())) for i in range(int(eval(input())))], reverse=True) print((x[0]//2 + sum(x[1:])))
p = [int(eval(input())) for i in range(int(eval(input())))] print((sum(p)-(max(p)//2)))
p03207
N = int(eval(input())) p = sorted([int(eval(input())) for _ in range(N)]) print((int(sum(p[0:N-1]) + p[N-1]/2)))
N = int(eval(input())) P = [int(eval(input())) for _ in range(N)] P.sort() print((sum(P[0:N-1])+P[N-1]//2))
p03207
N = int(eval(input())) p = [] for _ in range(N): p.append(int(eval(input()))) p = sorted(p, reverse=True) p[0] = p[0] // 2 total = 0 for value in p: total = total + value print(total)
N = int(eval(input())) p = sorted([int(eval(input())) for _ in range(N)], reverse=True) print((p[0] // 2 + sum(p[1:])))
p03207
n = int(eval(input())) ans = [] for i in range(n): ans.append(int(eval(input()))) ans.sort() ans[-1]//=2 print((sum(ans)))
n = int(eval(input())) a = [int(eval(input())) for i in range(n)] print((sum(a)-max(a)//2))
p03207
l=[int(eval(input())) for _ in range(int(eval(input())))] print((sum(l)-int(max(l)/2)))
n=int(eval(input())) p=sorted([int(eval(input())) for i in range(n)]) print((p[-1]//2+sum(p[:-1])))
p03207
n=int(eval(input())) a=[int(eval(input())) for i in range(n)] print((int(sum(a)-max(a)/2)))
N = int(eval(input())) L = [int(eval(input())) for i in range(N)] print((sum(L)-int(max(L)/2)))
p03207
import itertools import math import fractions import functools import copy n = int(eval(input())) p = [] for i in range(n): p.append(int(eval(input()))) print((sum(p)-max(p)//2))
def main(): n = int(eval(input())) # t, a = map(int, input().split()) # h = list(map(int, input().split())) # s = input() p = [] for i in range(n): p.append(int(eval(input()))) maxi = max(p) print((sum(p) - maxi//2)) if __name__ == '__main__': main()
p03207
n,*p=list(map(int,open(0).read().split()));print((sum(p)-max(p)//2))
_,*p=list(map(int,open(0).readlines()));print((sum(p)-max(p)//2))
p03207
n = int(eval(input())) p = [int(eval(input())) for _ in range(n)] p.sort() print((sum(p) - p[len(p)-1] + p[len(p)-1] // 2))
n = int(eval(input())) p = [int(eval(input())) for _ in range(n)] p.sort() print((sum(p[:-1]) + p[-1] // 2))
p03207
a,*n=list(map(int,open(0)));print((int(sum(n)-max(n)/2)))
a,*n=list(map(int,open(0)));print((sum(n)-max(n)//2))
p03207
n = sorted(map(int, [eval(input()) for _ in range(int(eval(input())))])) max_price_half = n[-1] / 2 total = sum(n) - n.pop(-1) + max_price_half print((int(total)))
n = sorted(map(int, [eval(input()) for _ in range(int(eval(input())))])) print((sum(n[:-1]) + n[-1] // 2))
p03207
l=int(eval(input())) b=[int(eval(input())) for i in range(l)] print((sum(b)-max(b)//2))
l=int(eval(input())) b=[int(eval(input())) for i in range(l)] print((int(sum(b)-max(b)/2)))
p03207
N = int(eval(input())) p = [] for i in range(N): p.append(int(eval(input()))) mxi = p.index(max(p)) p[mxi] = p[mxi]//2 s = 0 for i in range(N): s = s+p[i] print(s)
N = int(eval(input())) p = [0]*N s = 0 for i in range(N): p[i] = int(eval(input())) s = s + p[i] print((s-max(p)//2))
p03207
N = int(eval(input())) P = [int(eval(input())) for X in range(0,N)] P[P.index(max(P))] = max(P)//2 print((sum(P)))
N = int(eval(input())) P = sorted([int(eval(input())) for X in range(0,N)]) P[-1] = P[-1]//2 print((sum(P)))
p03207
n = int(eval(input())) p = [int(eval(input())) for i in range(n)] p.sort(reverse=True) ans = 0 for t in p: ans += t print((int(ans - p[0] / 2)))
l = [int(eval(input())) for i in range(int(eval(input())))] print((int(sum(l) - max(l)/2)))
p03207
N=int(eval(input())) P=[int(eval(input())) for i in range(N)] print((round(sum(P)-1/2*max(P))))
n=int(eval(input())) A=[int(eval(input())) for i in range(n)] print((sum(A)-max(A)//2))
p03207
import sys input = sys.stdin.readline N = int(eval(input())) a = list(map(int, input().split())) a.sort() def check(x): b = [0] * N for i in range(N): b[i] = a[i] + x t = x for i in range(N): if t * (N + 1) >= b[i] - (N - 1): t -= -(-(b[i] - (N - 1)) // (N + 1)) else: retur...
import sys input = sys.stdin.readline N = int(eval(input())) a = list(map(int, input().split())) def check(x): b = a[: ] for i in range(N): b[i] += x c = 0 for i in range(N): t = max(0, b[i] - (N - 1)) c += -(-t // (N + 1)) return c <= x ok = sum(a) ng = -1 while ok - ng > 1: ...
p03649
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 flag = True while flag: flag = False for i in range(N): if A[i] >= N: count = A[i] // N ans += count for j in range(N): A[j] += count A[i] -= count ...
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 flag = True while flag: flag = False for i in range(N): if A[i] >= N: count = A[i] // N ans += count for j in range(N): A[j] += count A[i] -= count ...
p03649
N=int(eval(input())) a=[int(i) for i in input().split()] ans=0 while True: f=0 for i in range(N): if a[i]>=N: d=a[i]//N ans+=d a[i]%=N for j in range(N): if i!=j: a[j]+=d f=1 break if f==0: break print(ans)
N=int(eval(input())) a=[int(i) for i in input().split()] ans=0 while True: f=0 for i in range(N): if a[i]>=N: d=a[i]//N ans+=d a[i]%=N for j in range(N): if i!=j: a[j]+=d else: f+=1 if f==N: break print(ans)
p03649
# coding: utf-8 INF = 10 ** 20 MOD = 10 ** 9 + 7 def II(): return int(eval(input())) def ILI(): return list(map(int, input().split())) def read(): N = II() a = ILI() return (N, a) def check_a(N, a): for i, _a in enumerate(a): if _a >= N: return i retu...
# coding: utf-8 INF = 10 ** 20 MOD = 10 ** 9 + 7 def II(): return int(eval(input())) def ILI(): return list(map(int, input().split())) def read(): N = II() a = ILI() return (N, a) def check_a(N, a): for _a in a: if _a >= N: return False return True ...
p03649
from sys import exit, setrecursionlimit, stderr from functools import reduce from itertools import * from collections import * from bisect import bisect def read(): return int(eval(input())) def reads(): return [int(x) for x in input().split()] N = read() A = [a-(N-1) for a in reads()] def poss...
from sys import exit, setrecursionlimit, stderr from functools import reduce from itertools import * from collections import * from bisect import bisect def read(): return int(eval(input())) def reads(): return [int(x) for x in input().split()] N = read() A = [a-(N-1) for a in reads()] def poss...
p03649
N, *A = list(map(int, open(0).read().split())) ans = 0 S = -1 while S: S = sum(a // N for a in A) ans += S A = [a % N + (S - a // N) for a in A] print(ans)
def main(): N, *A = list(map(int, open(0).read().split())) ans = 0 S = -1 while S: S = sum(a // N for a in A) ans += S A = [a % N + (S - a // N) for a in A] print(ans) main()
p03649
N = int(eval(input())) A = list(map(int,input().split())) ans = 0 while any([a>N-1 for a in A]): A.sort() d = A[-1] - (N-1) k = -(-d//N) ans += k A[-1] -= k*N for i in range(N-1): A[i] += k print(ans)
N = int(eval(input())) A = list(map(int,input().split())) ans = 0 while any([a>N-1 for a in A]): for i in range(N): if A[i] <= N-1: continue d = A[i] - (N-1) k = -(-d//N) A[i] -= k*N ans += k for j in range(N): if j==i: continue A...
p03649
N = int(eval(input())) A = list(map(int, input().split())) def is_possible(C): res = 0 for x in A: if x+C - N >= 0: res += (x+ C - N)//(N+1) + 1 #print(res,C) return int(res <= C) l = 0 # impossible r = 10**30 # possible is_possible(1234567894848) while r - l > 1:...
N = int(eval(input())) A = list(map(int, input().split())) def is_possible(C): res = 0 for x in A: if x+C - N >= 0: res += (x+ C - N)//(N+1) + 1 #print(res,C) return int(res <= C) l = 0 # impossible r = 10**30 # possible while r - l > 1: M = (l+r)//2 if...
p03649
n = int(eval(input())) a = list(map(int, input().split())) a.sort() ans = 0 while a[-1] >= n: k = -(-(a[-1]+1)//n)-1 ans += k for i in range(n-1): a[i] += k a[-1] -= n*k a.sort() print(ans)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 while True: tmp = 0 for i in range(n): k = -(-(a[i]+1)//n)-1 tmp += k a[i] -= k*n a[i] -= k for i in range(n): a[i] += tmp if not tmp: break ans += tmp print(ans)
p03649
def main(): x, y, _a, _b, _c = list(map(int, input().split())) p = sorted(map(int, input().split()))[-x:] q = sorted(map(int, input().split()))[-y:] r = sorted(map(int, input().split()), reverse=True)[:x + y] arr = sorted(p + q) for nc_apple in r: apple = arr[0] if apple >= nc_apple: b...
def main(): x, y, _a, _b, _c = list(map(int, input().split())) p = sorted(map(int, input().split()))[-x:] q = sorted(map(int, input().split()))[-y:] r = sorted(map(int, input().split()), reverse=True)[:x + y] arr = sorted(p + q) new_num = 0 for i, nc_apple in enumerate(r): if arr[i] >= n...
p02727
import sys input = 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() p = p[A-X:] q.sort() q = q[B-Y:] r.sort() a = p+q+r a.sort(reverse=True) print((sum(a[:X+Y])))
import sys input = sys.stdin.readline def main(): X, Y, A, B, C = list(map(int, input().split())) p = list(map(int, input().split())) p.sort(reverse=True) q = list(map(int, input().split())) q.sort(reverse=True) r = list(map(int, input().split())) r.sort(reverse=True) target = ...
p02727
x, y, a, b, c = list(map(int, input().split())) list_A = list(map(int, input().split())) list_B = list(map(int, input().split())) list_C = list(map(int, input().split())) list_N = [] for i in list_A: list_N.append([i, "A"]) for i in list_B: list_N.append([i, "B"]) for i in list_C: list_N.app...
x, y, a, b, c = list(map(int, input().split())) list_A = list(map(int, input().split())) list_B = list(map(int, input().split())) list_C = list(map(int, input().split())) list_A.sort(reverse=True) list_B.sort(reverse=True) list_C.sort(reverse=True) list_N = list_A[:x] + list_B[:y] + list_C[:min(c, x + y)] lis...
p02727
x, y, a, b, c = list(map(int, input().split())) red = sorted(list(map(int, input().split())), reverse=True) gre = sorted(list(map(int, input().split())), reverse=True) non = sorted(list(map(int, input().split())), reverse=True) eat = [] for i in range(x): eat.append(red.pop(0)) for i in range(y):...
x, y, a, b, c = list(map(int, input().split())) red = sorted(list(map(int, input().split())), reverse=True) gre = sorted(list(map(int, input().split())), reverse=True) non = sorted(list(map(int, input().split())), reverse=True) red = red[0:x] gre = gre[0:y] eat = red + gre + non eat.sort(reverse=True) ...
p02727
X,Y,A,B,C=list(map(int, input().split())) AA=list(map(int, input().split())) BB=list(map(int, input().split())) CC=list(map(int, input().split())) AA=sorted(AA,reverse=True) BB=sorted(BB,reverse=True) CC=sorted(CC,reverse=True) AAA=AA[0:X] BBB=BB[0:Y] for i in CC: if i>min(AAA)or i>min(BBB): if m...
X,Y,A,B,C=list(map(int, input().split())) AA=list(map(int, input().split())) BB=list(map(int, input().split())) CC=list(map(int, input().split())) AA=sorted(AA,reverse=True) BB=sorted(BB,reverse=True) CC=sorted(CC,reverse=True) XX=sorted(AA[0:X]+BB[0:Y]+CC,reverse=True) XX=XX[0:X+Y] print((sum(XX)))
p02727
from collections import deque N_red_toEat, N_green_toEat, N_red, N_green, N_white = list(map(int, input().split())) delicious_red = list(map(int, input().split())) delicious_green = list(map(int, input().split())) delicious_white = list(map(int, input().split())) delicious_red.sort(reverse=True) delicious_g...
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 = sorted(a, reverse=True)[:x] b = sorted(b, reverse=True)[:y] al = a + b + c al.sort(reverse=True) ans = sum(al[: x + y]) print(ans)
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(reverse=True) rcount=0 ans=[] for i in range(x): ans.append(p[-1-i]) for i in range(y): ans.append(q[-1-i]) ans.sort() for i in range(min...
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=[] for i in range(x): r.append(p[i]) for i in range(y): r.append(q[i]) r.sort(reverse=True) print((sum(r[0: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() p.reverse() q.sort() q.reverse() r.append(0) r.sort() r.reverse() ct=0 P=p[0:x] Q=q[0:y] L=P+Q L.sort() R=0 for i in range(len(L)): if r[R]>L[i]: ...
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() L=p[a-x:a]+q[b-y:b]+r L.sort() L.reverse() print((sum(L[0:x+y])))
p02727
x, y, a, b, c = list(map(int,input().split())) red = sorted(list(map(int,input().split())))[a-x:] green = sorted(list(map(int,input().split())))[b-y:] white = sorted(list(map(int,input().split()))) rcnt = 0 gcnt = 0 ans = 0 #print(red,green,white) for i in range(x+y): # print(red,green,white) if ...
x, y, a, b, c = list(map(int,input().split())) red = sorted(list(map(int,input().split())),reverse=True)[:x] green = sorted(list(map(int,input().split())),reverse=True)[:y] white = sorted(list(map(int,input().split())),reverse=True) l = sorted(red+green+white,reverse=True)[:x+y] print((sum(l)))
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())) red = [[i, "r"] for i in p] green = [[i, "g"] for i in q] white = [[i, "w"] for i in r] total = sorted(red + green + white)[::-1] ans = 0 cnt = 0 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:] r = list(map(int, input().split())) total = sorted(p + q + r)[::-1] print((sum(total[: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())) C = list(map(int, input().split())) R.sort() R.reverse() G.sort() G.reverse() C.sort() C.reverse() R = R[:X] G = G[:Y] temp = 0 for i in range(len(C)) : if((X==0) and (Y==0))...
X, Y, A, B, C = list(map(int, input().split())) R = list(map(int, input().split())) G = list(map(int, input().split())) C = list(map(int, input().split())) R.sort() R.reverse() G.sort() G.reverse() C.sort() C.reverse() R = R[:X] G = G[:Y] temp = 0 for i in range(len(C)) : if((X==0) and (Y==0))...
p02727
import sys X, Y, A, B, C = list(map(int, sys.stdin.readline().strip().split())) P = list(map(int, sys.stdin.readline().strip().split())) Q = list(map(int, sys.stdin.readline().strip().split())) R = list(map(int, sys.stdin.readline().strip().split())) P.sort(reverse=True) Q.sort(reverse=True) R.sort(reverse...
import sys X, Y, A, B, C = list(map(int, sys.stdin.readline().strip().split())) P = list(map(int, sys.stdin.readline().strip().split())) Q = list(map(int, sys.stdin.readline().strip().split())) R = list(map(int, sys.stdin.readline().strip().split())) P.sort(reverse=True) Q.sort(reverse=True) R.sort(reverse...
p02727
def red_and_green_apples(X, Y, A, B, C, P, Q, R): P.sort(reverse=True) Q.sort(reverse=True) R.sort(reverse=True) P = P[:X] Q = Q[:Y] q = P + Q + R q.sort(reverse=True) return sum(q[:X + Y]) X, Y, A, B, C = list(map(int, input().split())) P = list(map(int, input().split(...
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) a = P[:X] + Q[:Y] + R a.sort(reverse=True) print((sum(a[:X + Y])))
p02727
LMIIS = lambda: list(map(int,input().split())) X,Y,*e = LMIIS() P = LMIIS() Q = LMIIS() R = LMIIS() P.sort(reverse=True) Q.sort(reverse=True) R.sort(reverse=True) print((sum(sorted(P[:X]+Q[:Y]+R,reverse=True)[:X+Y])))
f=lambda:list(map(int,input().split())) X,Y,*e=f() P=f() Q=f() R=f() P.sort() Q.sort() R.sort() print((sum(sorted(P[-X:]+Q[-Y:]+R)[-X-Y:])))
p02727
import sys input = sys.stdin.readline from heapq import * 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) pq = [] ans = 0 for i in range(X): heappush(...
import sys input = 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(reverse=True) q.sort(reverse=True) r.sort(reverse=True) l = p[:X]+q[:Y] l.sort() s = sum(l) ans = s pre ...
p02727
import heapq x, y, a, b, c = list(map(int, input().split())) def max_listup(limit): l = list([int(x)*-1 for x in input().split()]) heapq.heapify(l) cnt = 1 res = [] while l: if cnt > limit: break m = heapq.heappop(l) res.append(m*-1) cnt += 1 return res if __name__ ...
import heapq x, y, a, b, c = list(map(int, input().split())) def max_listup(limit): l = sorted(list(map(int, input().split()))) cnt = 1 res = [] while l: if cnt > limit: break m = l.pop() res.append(m) cnt += 1 return res if __name__ == "__main__": all = sorted(max_...
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())) z = sorted(p)[-X:] + sorted(q)[-Y:] + r print((sum(sorted(z)[-(X+Y):])))
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())) cand = sorted(P[-X:] + Q[-Y:] + R) print((sum(cand[-X-Y:])))
p02727
x,y,a,b,c = list(map(int, input().split())) result=sorted(list(map(int, input().split())), reverse=True)[:x] result+=sorted(list(map(int, input().split())), reverse=True)[:y] r=sorted(list(map(int, input().split())), reverse=True) s = sum(result) for el in r: t = el - min(result) if t>0: s += t ...
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 = p[:x] + q[:y] + r result = sorted(result, reverse=True) print((sum(result[:x+y])))
p02727
# -*- coding: utf-8 -*- """ Created on Tue Apr 28 22:12:42 2020 """ import sys #import numpy as np sys.setrecursionlimit(10 ** 9) #def input(): # return sys.stdin.readline()[:-1] mod = 10**9+7 #N = int(input()) X, Y, A, B, C = list(map(int,input().split())) r = list(map(int,input().split())) g = l...
# -*- coding: utf-8 -*- """ Created on Tue Apr 28 22:12:42 2020 """ import sys #import numpy as np sys.setrecursionlimit(10 ** 9) #def input(): # return sys.stdin.readline()[:-1] mod = 10**9+7 #N = int(input()) X, Y, A, B, C = list(map(int,input().split())) r = list(map(int,input().split())) g = l...
p02727
x, y, a, b, c = list(map(int,input().split())) datp = list(map(int, input().split())) datq = list(map(int, input().split())) datr = list(map(int, input().split())) datp.sort(reverse=True) datq.sort(reverse=True) datr.sort(reverse=True) res = sum(datp[:x]) + sum(datq[:y]) pl, pr = 0, x - 1 ql, qr = 0, y - 1 #p...
x, y, a, b, c = list(map(int,input().split())) datp = sorted(list(map(int, input().split())), reverse=True) datq = sorted(list(map(int, input().split())), reverse=True) datr = sorted(list(map(int, input().split())), reverse=True) dat = sorted(datp[:x] + datq[:y] + datr, reverse=True) print((sum(dat[:x+y])))
p02727
import sys input = sys.stdin.readline X, Y, A, B, C = (int(i) for i in input().split()) p = [[int(x), "A"] for x in input().split()] q = [[int(x), "B"] for x in input().split()] r = [[int(x), "C"] for x in input().split()] #A = [[int(i) for i in input().split()] for i in range(N)] apples = p+q+r apples.sort...
import sys input = sys.stdin.readline X, Y, A, B, C = (int(i) for i in input().split()) p = [[int(x), "A"] for x in input().split()] q = [[int(x), "B"] for x in input().split()] r = [[int(x), "C"] for x in input().split()] #A = [[int(i) for i in input().split()] for i in range(N)] apples = p+q+r apples.sort...
p02727
x, y, a, b, c = list(map(int, input().split())) pn = list(map(int, input().split())) qn = list(map(int, input().split())) rn = list(map(int, input().split())) pn.sort(reverse=True) qn.sort(reverse=True) rn.sort(reverse=True) pq = pn[:x] + qn[:y] rcount = 0 while min(pq) <= rn[0]: pq.remove(min(pq)) ...
x, y, a, b, c = list(map(int, input().split())) pn = list(map(int, input().split())) qn = list(map(int, input().split())) rn = list(map(int, input().split())) pn.sort(reverse=True) qn.sort(reverse=True) pqr = pn[:x] + qn[:y] + rn pqr.sort(reverse=True) print((sum(pqr[: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())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) a=p[0:X]+q[0:Y] heapq.heapify(a) #print(a) #print(a[0]) flag=True while flag: ...
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) r.sort() s = p[:X]+q[:Y] ans=sum(s) heapq.heapify(s) while r and s: if s[0]<r[-1]: ans += r[-1...
p02727
from sys import stdin nii=lambda:list(map(int,stdin.readline().split())) lnii=lambda:list(map(int,stdin.readline().split())) from bisect import insort x,y,a,b,c=nii() p=lnii() q=lnii() r=lnii() p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) l=p[:x]+q[:y] l.sort() for i in r: inso...
from sys import stdin nii=lambda:list(map(int,stdin.readline().split())) lnii=lambda:list(map(int,stdin.readline().split())) x,y,a,b,c=nii() p=lnii() q=lnii() r=lnii() p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) l=p[:x]+q[:y] l.sort() ans=0 for i in range(x+y): if i<c: an...
p02727
X, Y, A, B, C=list(map(int, input().split())) p=list(map(int, input().split())) p.sort() q=list(map(int, input().split())) q.sort() r=list(map(int, input().split())) r.sort(reverse=True) i=-X j=-Y k=0 deru=0 while deru==0 and k<C and (r[k]>p[i] or r[k]>q[j]): if p[i]>q[j] and j<0: j+=1 k+=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() q.sort() nums=p[-X:]+q[-Y:]+r nums.sort() print((sum(nums[-(X+Y):])))
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) EP=P[0:X] EQ=Q[0:Y] # for i in range(X): # EP.append(P[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=True) EP=P[0:X] EQ=Q[0:Y] # for i in range(X): # EP.append(P[i]) ...
p02727
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): X, Y, A, B, C = [int(x) for x in 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(reve...
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): X, Y, A, B, C = [int(x) for x in 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(reve...
p02727
X,Y,A,B,C = (int(x) for x in input().split()) red = list(map(int, input().strip().split())) green = list(map(int, input().strip().split())) clear = list(map(int, input().strip().split())) red.sort(reverse=True) green.sort(reverse=True) clear.sort(reverse=True) pre_answer = 0 answer = 0 for i in range (max(X+Y,...
X,Y,A,B,C = (int(x) for x in input().split()) red = list(map(int, input().strip().split())) green = list(map(int, input().strip().split())) clear = list(map(int, input().strip().split())) red.sort(reverse=True) green.sort(reverse=True) # clear.sort(reverse=True) apple = red[0:X] + green[0:Y] + clear apple.sort(...
p02727
X,Y,A,B,C=list(map(int,input().split())) ls_a=sorted(list(map(int,input().split()))) ls_b=sorted(list(map(int,input().split()))) ls_c=sorted(list(map(int,input().split()))) ls_x=ls_a[A-X:A] ls_y=ls_b[B-Y:B] ls_c.reverse() ans=sum(ls_x)+sum(ls_y) a=b=c=0 for _ in range(min([X+Y,C])): if a==len(ls_x): ...
X,Y,A,B,C=list(map(int,input().split())) ls_a=list(map(int,input().split())) ls_b=list(map(int,input().split())) ls_c=list(map(int,input().split())) ls_a.sort(reverse=True) ls_b.sort(reverse=True) ls_c.sort(reverse=True) ls=sorted(ls_a[:X]+ls_b[:Y]) ans=sum(ls) for i in range(min(X+Y, C)): if ls[i] < ...
p02727
from heapq import heapify, heappop, heappush, heappushpop import sys input = 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(reverse=True) q.sort(reverse=True) r.sort() p=p[:x] q=q[:y] h...
import sys input = 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(reverse=True) q.sort(reverse=True) p=p[:x] q=q[:y] r=r+p+q r.sort(reverse=True) print((sum(r[:x+y])))
p02727
X,Y,A,B,C = list(map(int, input().split())) As = sorted(list(map(int, input().split())), reverse=True) Bs = sorted(list(map(int, input().split())), reverse=True) Cs = sorted(list(map(int, input().split())), reverse=True) s = 0 _C = 0 while A+B+C > 0: if X+Y == _C: break if X+Y == 0: break mx ...
X,Y,A,B,C = list(map(int, input().split())) As = sorted(list(map(int, input().split())), reverse=True) Bs = sorted(list(map(int, input().split())), reverse=True) Cs = list(map(int, input().split())) As = As[:X] Bs = Bs[:Y] ans = 0 Xs = sorted(As+Bs+Cs, reverse=True) print((sum(Xs[:X+Y])))
p02727
f=lambda:list(map(int,input().split())) x,y,a,b,c=f() p=sorted(f())[::-1] q=sorted(f())[::-1] r=sorted(f())[::-1] lp,lq,lr=[0]*(a+1),[0]*(b+1),[0]*(c+1) s=t=u=m=0 for i in range(a): s+=p[i]; lp[i+1]+=s for i in range(b): t+=q[i]; lq[i+1]+=t for i in range(c): u+=r[i]; lr[i+1]+=u for i in range(min(x,c)+1): ...
f=lambda:list(map(int,input().split())) x,y,a,b,c=f() l=sorted(sorted(f())[-x:]+sorted(f())[-y:]+list(f())) print((sum(l[-x-y:])))
p02727
X, Y, A, B, C = list(map(int, input().split())) pList = list(map(int, input().split())) qList = list(map(int, input().split())) rList = list(map(int, input().split())) pList.sort(reverse=True) qList.sort(reverse=True) rList.sort(reverse=True) pList = pList[:X] qList = qList[:Y] value = 0 for indx in...
X, Y, A, B, C = list(map(int, input().split())) pList = list(map(int, input().split())) qList = list(map(int, input().split())) rList = list(map(int, input().split())) pList.sort(reverse=True) qList.sort(reverse=True) rList.sort(reverse=True) pList = pList[:X] qList = qList[:Y] appleList = pList + qLis...
p02727
import heapq x,y,a,b,c=list(map(int,input().split())) arr1=list(map(int,input().split())) arr2=list(map(int,input().split())) arr3=list(map(int,input().split())) q=[] for val in arr1: heapq.heappush(q,(-val,1)) for val in arr2: heapq.heappush(q,(-val,2)) for val in arr3: heapq.heappush(q,(-val,3)) a...
x,y,a,b,c=list(map(int,input().split())) arr1=list(map(int,input().split())) arr1=sorted(arr1,reverse=True) arr1=arr1[:x] arr2=list(map(int,input().split())) arr2=sorted(arr2,reverse=True) arr2=arr2[:y] arr3=list(map(int,input().split())) ans=arr1+arr2+arr3 ans=sorted(ans,reverse=True) print((sum(ans[: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())) p = sorted(p, reverse = True)[:x] q = sorted(q, reverse = True)[:y] r = sorted(r, reverse = True) for i in range(min(x+y, len(r))): if min...
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 = sorted(p, reverse = True)[:x] q = sorted(q, reverse = True)[:y] r = sorted(r, reverse = True) pqr = p + q + r pqr = sorted(pqr, reverse ...
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) x=0 y=0 z=0 s=0 while (x<X or y<Y) and z<X+Y: if (max(p[0],q[0],r[0])==p[0] or (y==Y and r[0]<p[0])) an...
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) x=0 y=0 R=0 z=0 s=0 while (x<X or y<Y) and z<X+Y: if (max(p[0],q[0],r[0])==p[0] or (y==Y and r[0]<p[0]...
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())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) p=p[:x] q=q[:y] heapq.heapify(p) heapq.heapify(q) for i in range(c): pp=heapq.heappop(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) lis=p[:x]+q[:y]+r lis.sort(reverse=True) ans=0 for i in range(x+y): ans+=lis[i] print(ans)
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) tot=sum(p[:X])+sum(q[:Y]) a=0 b=0 for i in r: if a==X and b==Y: break elif a==X: ...
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] z=p+q+r z.sort(reverse=True) tot=sum(z[:X+Y]) print(tot)
p02727
# coding: utf-8 # Your code here! x,y,a,b,c = list(map(int,input().split())) p_a = list(map(int,input().split())) p_b = list(map(int,input().split())) p_c = list(map(int,input().split())) p_a.sort(reverse=True) p_b.sort(reverse=True) p_c.sort(reverse=True) p_c += [0] ans = p_a[:x] + p_b[:y] ans.sort(reve...
x,y,a,b,c = list(map(int,input().split())) p_a = list(map(int,input().split())) p_b = list(map(int,input().split())) p_c = list(map(int,input().split())) p_a.sort(reverse=True) p_b.sort(reverse=True) #p_c.sort(reverse=True) ans = p_a[:x] + p_b[:y] + p_c ans.sort(reverse=True) print((sum(ans[:x+y])))
p02727
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from...
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from...
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())) eat = [] # 食べる p.sort(reverse=True) if X > A: eat.extend(p) else: eat.extend(p[:X]) q.sort(reverse=True) if Y > B: eat.extend(q) els...
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())) eat = [] # 食べる p.sort(reverse=True) if X > A: eat.extend(p) else: eat.extend(p[:X]) q.sort(reverse=True) if Y > B: eat.extend(q) els...
p02727
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) A.sort() B.sort() C.sort(reverse=True) A=A[a-x:] B=B[b-y:] i=0 j=0 k=0 lea=len(A) leb=len(B) while(True): if len(C)<1: break ...
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) A.sort() B.sort() A=A[a-x:] B=B[b-y:] D=A+B+C D.sort(reverse=True) sum=0 for i in range(x+y): sum+=D[i] print(sum)
p02727
x,y,a,b,c=list(map(int,input().split())) r=sorted(list(map(int,input().split())),reverse=True) g=sorted(list(map(int,input().split())),reverse=True) w=sorted(list(map(int,input().split())),reverse=True) p=sorted(r[:x]+g[:y],reverse=True) i=0 ans=0 while i<x+y: if w==[] or p[0]>w[0]: ans+=p.pop...
x,y,a,b,c=list(map(int,input().split())) r=sorted(list(map(int,input().split())),reverse=True) g=sorted(list(map(int,input().split())),reverse=True) w=list(map(int,input().split())) p=sorted(r[:x]+g[:y]+w,reverse=True) print((sum(p[:x+y])))
p02727
#!/usr/bin/python3 # -*- coding:utf-8 -*- def main(): x, y, a, b, c = list(map(int, input().split())) la = list(map(int, input().split())) la.sort(reverse=True) lb = list(map(int, input().split())) lb.sort(reverse=True) lc = list(map(int, input().split())) lc.sort(reverse=True) ca, cb, cc = ...
#!/usr/bin/python3 # -*- coding:utf-8 -*- def main(): x, y, na, nb, nc = list(map(int, input().split())) la = list(map(int, input().split())) la.sort(reverse=True) lb = list(map(int, input().split())) lb.sort(reverse=True) lc = list(map(int, input().split())) lc.sort(reverse=True) ca, cb, ...
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() del p[:a-x] del q[:b-y] s=p+q s.sort() i=c-1 while r[i]>s[0] and i>=0 : s[0]=r[i] s.sort() i -= 1 print((sum(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) del p[:a-x] del q[:b-y] s=p+q s.sort() if s[0]<r[0]: s[0]=r[0] for i in range(1,c): if s[i]>=r[i]: ...
p02727
import heapq X, Y, A, B, C = list(map(int, input().split())) P = sorted([int(i) for i in input().split()], reverse=True) Q = sorted([int(i) for i in input().split()], reverse=True) R = sorted([int(i) for i in input().split()], reverse=True) hq = P[:X]+Q[:Y] ans = sum(hq) heapq.heapify(hq) # リストhqのheap化 i...
X, Y, A, B, C = list(map(int, input().split())) P = sorted([int(i) for i in input().split()], reverse=True) Q = sorted([int(i) for i in input().split()], reverse=True) R = sorted([int(i) for i in input().split()]) S = sorted(P[:X]+Q[:Y]+R, reverse=True) print((sum(S[:X+Y])))
p02727
import bisect x, y, a, b, c = list(map(int, input().split())) p = [int(_) for _ in input().split()] q = [int(_) for _ in input().split()] r = [int(_) for _ in input().split()] p.sort() q.sort() r.sort() x_list = p[-x:] y_list = q[-y:] while (min(x_list[0], y_list[0]) < r[-1]): if x_list[0] > y_li...
x, y, a, b, c = list(map(int, input().split())) p = [int(_) for _ in input().split()] q = [int(_) for _ in input().split()] r = [int(_) for _ in input().split()] p.sort() q.sort() r.sort() x_list = p[-x:] y_list = q[-y:] all_apple = x_list + y_list + r all_apple.sort() print((sum(all_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())) result = 0 Z = 0 while (X>0 or Y>0) and X+Y-Z>0: p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) if (X>0 or Y>0) and X+...
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) p = p[0:X] q = q[0:Y] p.extend(q) p.extend(r) p.sort(reverse=True) s=0 for i in rang...
p02727
x,y,a,b,c=[int(i) for i in input().split()] red_list=[int(i) for i in input().split()] green_list=[int(i) for i in input().split()] non_col_list=[int(i) for i in input().split()] red_list.sort() green_list.sort() non_col_list.sort() eat_red=[] eat_green=[] for i in range(x): eat_red.append(red_list....
x,y,a,b,c=[int(i) for i in 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() q.sort() r.sort() p=p[-x:] q=q[-y:] ans=p+q+r ans.sort() ans=ans[-x-y:] print((sum(ans)))
p02727
# -*- coding: utf-8 -*- 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())) def sort(L): if len(L)==1: return L left = sort(L[:len(L)//2]) right = sort(L[len(L)//2:...
# -*- coding: utf-8 -*- 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 = sorted(P, reverse=True)[:X] Q = sorted(Q, reverse=True)[:Y] R = sorted(P+Q+R, reverse=True)[:X+Y...
p02727
# -*- coding: utf-8 -*- 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 = sorted(P, reverse=True)[:X] Q = sorted(Q, reverse=True)[:Y] R = sorted(P+Q+R, reverse=True)[:X+Y...
# -*- 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 = sorted(P, reverse=True)[:X] Q = sorted(Q, reverse=True)[:Y] R = sorted(P+Q+R, reverse=True)[:X+Y] print((sum(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) P = P[:X] Q = Q[:Y] All = P + Q + R All.sort(reverse = True) print((sum(All[:X+Y])))
def main(): import sys def input(): return sys.stdin.readline().rstrip() 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) ...
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) ls = [] for i in range(X): ls.append(p[i]) for i in range(Y): ls.append(q[i]) ...
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) ls = [] for i in range(X): ls.append(p[i]) for i in range(Y): ls.append(q[i]) ...
p02727
from heapq import heapify, heappush, heappop def greenandredapples(): X, Y, A, B, C = list(map(int, input().split())) RedD = sorted(list(map(int, input().split()))) GreenD = sorted(list(map(int, input().split()))) Colorl = sorted(list(map(int, input().split()))) considered = RedD[-X:] + Gree...
def greenandredapples(): X, Y, A, B, C = list(map(int, input().split())) RedD = sorted(list(map(int, input().split()))) GreenD = sorted(list(map(int, input().split()))) Colorl = sorted(list(map(int, input().split()))) considered = RedD[-X:] + GreenD[-Y:] Colorl.extend(considered) re...
p02727
x, y, a, b, c = list(map(int, input().split())) p = sorted(list(map(int, input().split())), reverse=True) pp = p[:] q = sorted(list(map(int, input().split())), reverse=True) qq = q[:] r = sorted(list(map(int, input().split())), reverse=True) rr = r[:] ans1 = 0 for _ in range(x): if len(p) > 0 and len(r) > ...
x, y, a, b, c = list(map(int, input().split())) p = sorted(list(map(int, input().split())), reverse=True) pp = p[:x] q = sorted(list(map(int, input().split())), reverse=True) qq = q[:y] r = list(map(int, input().split())) l = pp + qq + r l.sort(reverse=True) print((sum(l[:(x + y)])))
p02727
apples = [(0, 'X') for x in range(300001)] apples_idx = 0 def append_a(n): global apples global apples_idx apples[apples_idx] = (n, 'A') apples_idx += 1 def append_b(n): global apples global apples_idx apples[apples_idx] = (n, 'B') apples_idx += 1 def append_c(n): ...
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) value = sum(apples[:X+Y]) print(value)
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) np=p[0:x] nq=q[0:y] np.extend(nq) np.sort() for i in range(min(len(np),len(r))): if np[i]<r[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) np=p[0:x] nq=q[0:y] np.extend(nq) m=min(np) nr=[i for i in r if i>=m] np.extend(nr) np.sort(reve...
p02727
s = [int(e) for e in input().split()] x = int(s[0]) y = int(s[1]) a = int(s[2]) b = int(s[3]) c = int(s[4]) a_l = [int(e) for e in input().split()] b_l = [int(e) for e in input().split()] c_l = [int(e) for e in input().split()] a_l.sort(reverse=True) b_l.sort(reverse=True) c_l.sort(reverse=True) apple =...
import sys stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(stdin.readline().rstrip()) nm = lambda: list(map(int, stdin.readline().split())) nl = lambda: list(map(int, stdin.readline().split())) x, y, a, b, c = nm() p = nl() q = nl() r = nl() p.sort() q.sort() l = p[-x:] + q[-y:...
p02727
X, Y, A, B, C = list(map(int, input().split())) red = list(map(int, input().split())) green = list(map(int, input().split())) no = list(map(int, input().split())) red = sorted(red, reverse=True)[:X] green = sorted(green, reverse=True)[:Y] no = sorted(no, reverse = True)[:X+Y] for i in range(len(no)): mi...
X, Y, A, B, C = list(map(int, input().split())) red = list(map(int, input().split())) green = list(map(int, input().split())) no = list(map(int, input().split())) red = sorted(red, reverse=True)[:X] green = sorted(green, reverse=True)[:Y] no = sorted(no, reverse = True)[:X+Y] co = sorted(red+green) for i ...
p02727
def main(): import sys input = sys.stdin.buffer.readline X, Y, A, B, C = (int(i) for i in 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()] from heapq import heapify, heappop heapify(P) heapi...
def main(): import sys input = sys.stdin.buffer.readline X, Y, A, B, C = (int(i) for i in 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) R.extend(P[:...
p02727
x, y, a, b, c = [int(i) for i in input().split()] pa = [int(i) for i in input().split()] pb = [int(i) for i in input().split()] pc = [int(i) for i in input().split()] pa = sorted(pa, reverse=True) pa = pa[:x] pb = sorted(pb, reverse=True) pb = pb[:y] pc = sorted(pc, reverse=True) l = pa + pb l = sorted(l,...
x, y, a, b, c = [int(i) for i in input().split()] pa = [int(i) for i in input().split()] pb = [int(i) for i in input().split()] pc = [int(i) for i in input().split()] pa = sorted(pa, reverse=True) pa = pa[:x] pb = sorted(pb, reverse=True) pb = pb[:y] pc = sorted(pc, reverse=True) l = pa + pb + pc l = sort...
p02727
import bisect X,Y,A,B,C=list(map(int,input().split())) AList=list(map(int,input().split())) BList=list(map(int,input().split())) CList=list(map(int,input().split())) AList.sort(reverse=True) BList.sort(reverse=True) CList.sort(reverse=True) alist = AList[0:X] + BList[0:Y] clist = CList alist.sort() ans...
import bisect X,Y,A,B,C=list(map(int,input().split())) AList=list(map(int,input().split())) BList=list(map(int,input().split())) CList=list(map(int,input().split())) AList.sort(reverse=True) BList.sort(reverse=True) CList.sort(reverse=True) alist = AList[0:X] + BList[0:Y] + CList alist.sort(reverse=True)...
p02727
X, Y, A, B, C = list(map(int, input().split())) p, pi = sorted(list(map(int, input().split())), reverse=True)[:X] + [-1], 0 q, qi = sorted(list(map(int, input().split())), reverse=True)[:Y] + [-1], 0 r, ri = sorted(list(map(int, input().split())), reverse=True) + [-1], 0 ans, nX, nY = 0, 0, 0 while nX < X or nY < ...
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 = list(map(int, input().split())) print((sum(sorted(p + q + r)[-(X + Y):])))
p02727
import heapq def main(): x, y, a, b, c = list(map(int,input().split())) p_ins = list(map(int,input().split())) q_ins = list(map(int,input().split())) r_ins = list(map(int,input().split())) p = select(p_ins, x) q = select(q_ins, y) r = select(r_ins, min(c, x + y)) res = 0 fo...
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())) pp = select(p, x) qq = select(q, y) res = select(pp + qq + r, x + y) print((sum(res))) def sele...
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) opt_p = deque(p[:x]) opt_q = deque(q[:y]) opt_r = deque(r...
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 = p[:x] + q[:y] + r[:x+y] s.sort(reverse=True) print((sum(s[:x+y])))
p02727
import statistics def quickSort(arr): left = [] right = [] if len(arr) <= 1: return arr median = int(statistics.median(arr)) medianFlg = 0 for element in arr: if element < median: left.append(element) elif element > median: right.append(element) else: medianFlg += 1...
def merge_sort(arr): if len(arr) <= 1: return arr mid = len(arr) // 2 # ここで分割を行う left = arr[:mid] right = arr[mid:] # 再帰的に分割を行う left = merge_sort(left) right = merge_sort(right) # returnが返ってきたら、結合を行い、結合したものを次に渡す return merge(left, right) def merge(left, right): merged = [] l_i, r_i = 0, 0 # ソー...
p02727