problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02725
u995419623
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['K,N = map(int,input().split())\nA = list(map(int,input().split()))\n\nmax_distance = K + (A[0] + A[-1])\n\nfor i in range(1,N):\n max_distance = max(max_distance, A[i] - A[i-1])\n \nprint(K - max_distance)', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\n\nmax_distance = K + (A[0] - A[-1])\n\nfor i in range(1,N):\n max_distance = max(max_distance, A[i] - A[i-1])\n \nprint(K - max_distance)']
['Wrong Answer', 'Accepted']
['s742942901', 's118966933']
[26436.0, 26444.0]
[135.0, 135.0]
[199, 199]
p02725
u999503965
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['k,n=map(int,input().split())\nl=list(map(int,input().split()))\n\ndiff=[]\nl.append(l[0]+k)\n\nfor i in range(n-1):\n diff.append(l[n+1]-l[n])\n \nprint(sum(diff)-max(diff))', 'k,n=map(int,input().split())\nl=list(map(int,input().split()))\n\ndiff=[]\nl.append(l[0]+k)\nfor i in range(n):\n diff.append(l[i+1]-l[i])\n\nprint(sum(diff)-max(diff))\n']
['Runtime Error', 'Accepted']
['s570386668', 's272109018']
[32304.0, 32240.0]
[71.0, 110.0]
[166, 162]
p02727
u011276976
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\n\nred = sorted(list(map(int, input().split())), reverse=True)[0:x-1]\ngre = sorted(list(map(int, input().split())), reverse=True)[0:y-1]\nnon = sorted(list(map(int, input().split())), reverse=True)\n\neat = red + gre + non\n\neat.sort(reverse=True)\n\nprint(sum(eat[0:x+y-1]))\n', 'x, y, a, b, c = map(int, input().split())\n\nred = sorted(list(map(int, input().split())), reverse=True)\ngre = sorted(list(map(int, input().split())), reverse=True)\nnon = sorted(list(map(int, input().split())), reverse=True)\n\nred = red[0:x]\ngre = gre[0:y]\n\neat = red + gre + non\n\neat.sort(reverse=True)\n\nprint(sum(eat[0:x+y]))\n']
['Wrong Answer', 'Accepted']
['s681446614', 's936059020']
[22488.0, 23200.0]
[240.0, 252.0]
[310, 325]
p02727
u012955130
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
["import heapq\n\nX, Y, A, B, C = map(int ,input().split(' '))\np = list(map(int ,input().split(' ')))\nq = list(map(int ,input().split(' ')))\nR = set(map(int ,input().split(' ')))\n\neat = sorted(p, reverse=True)[:X]\nheapq.heapify(eat)\n[heapq.heappush(eat, i) for i in sorted(q, reverse=True)[:Y]]\n\nfirst = min(eat)\nfor r in R:\n if r > first:\n eat.remove(min(eat))\n eat.append(r)\n first = heapq.heappop(eat)\n \nprint(sum(eat))", "X, Y, A, B, C = map(int ,input().split(' '))\np = list(map(int ,input().split(' ')))\nq = list(map(int ,input().split(' ')))\nR = list(map(int ,input().split(' ')))\n \neat = sorted(p, reverse=True)[:X]\neat[len(eat):] = sorted(q, reverse=True)[:Y]\neat[len(eat):] = R\neat.sort(reverse=True)\n\n\nprint(sum(eat[:X+Y]))"]
['Wrong Answer', 'Accepted']
['s216699436', 's602846584']
[29344.0, 23328.0]
[2105.0, 235.0]
[429, 308]
p02727
u017050982
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C =map(int,input().rstrip().split(" "))\nRA = list(map(int,input().rstrip().split(" ")))\nGA = list(map(int,input().rstrip().split(" ")))\nWA = list(map(int,input().rstrip().split(" ")))\nRA.sort()\nRA.reverse()\nGA.sort()\nGA.reverse()\nWA.sort()\nWA.reverse()\neatRA = X\neatGA = Y\neatWA = 0\nans = 0\nRAeatList = RA[:X]\nGAeatList = GA[:Y]\nwhile RAeatList[-1] < WA[0] or GAeatList[-1] < WA[0]:\n n= 1\n while RAeatList[-1 * n] == GAeatList[-1 * n] or n == min(X,Y) :\n n -= 1\n if RAeatList[-1 * n] < GAeatList[-1 * n]:\n RAeatList.pop(len(RAeatList) -1)\n RAeatList.insert(0,WA[0])\n else:\n GAeatList.pop(len(RAeatList) -1)\n GAeatList.insert(0,WA[0])\n if len(WA) == 1:\n break\n WA.pop(0)\n if eatWA == C:\n break\n\nfor i in range(X):\n ans += RAeatList[i]\nfor i in range(Y):\n ans += GAeatList[i]\nprint(ans)', 'X,Y,A,B,C =map(int,input().rstrip().split(" "))\nRA = list(map(int,input().rstrip().split(" ")))\nGA = list(map(int,input().rstrip().split(" ")))\nWA = list(map(int,input().rstrip().split(" ")))\nRA.sort()\nRA.reverse()\nGA.sort()\nGA.reverse()\nWA.sort()\nWA.reverse()\neatRA = X\neatGA = Y\neatWA = 0\nans = 0\nwhile RA[eatRA - 1] < WA[eatWA] or GA[eatGA -1] < WA[eatWA]:\n n= 1\n while RA[eatRA - n] == GA[eatGA -n] and n != min(eatRA,eatGA):\n n += 1\n if RA[eatRA - n] > GA[eatGA - n]:\n eatGA -= 1\n else:\n eatRA -= 1\n eatWA += 1\n if eatWA == C or eatRA == 0 or eatGA == 0:\n break\nif eatRA == 0 and eatGA != 0 and eatWA != C:\n while GA[eatGA -1] < WA[eatWA]:\n eatGA -= 1\n eatWA += 1\n if eatWA == C or eatGA == 0:\n break\nelif eatRA != 0 and eatGA == 0 and eatWA != C:\n while RA[eatRA -1] < WA[eatWA]:\n eatRA -= 1\n eatWA += 1\n if eatWA == C or eatRA == 0:\n break\nfor i in range(eatRA):\n ans += RA[i]\nfor i in range(eatGA):\n ans += GA[i]\nfor i in range(eatWA):\n ans += WA[i]\nprint(ans)']
['Runtime Error', 'Accepted']
['s976142570', 's386599948']
[23328.0, 23328.0]
[2104.0, 350.0]
[822, 1019]
p02727
u017415492
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\np.sort()\nq.sort()\nr.sort()\npcount=0\nqcount=0\nrcount=0\nans=[]\nfor i in range(x):\n ans.append(p[-1-i])\nfor i in range(y):\n ans.append(q[-1-i])\nans.sort()\nfor i in range(c):\n if rcount<len(r)-1 and ans[i]<=r[-1-rcount]:\n ans[i]=r[-1-rcount]\n rcount+=1\nprint(sum(ans))\n ', 'x,y,a,b,c=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\np.sort()\nq.sort()\nr.sort()\npcount=0\nqcount=0\nrcount=0\nans=[]\nfor i in range(x):\n ans.append(p[-1-i])\nfor i in range(y):\n ans.append(q[-1-i])\nans.sort()\nfor i in ragne(r):\n if ans[i]<=r[-1-rcount]:\n ans[i]=r[-1-rcount]\n rcount+=1\nprint(sum(ans))\n ', 'x,y,a,b,c=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\np.sort()\nq.sort()\nr.sort()\npcount=0\nqcount=0\nrcount=0\nans=[]\nfor i in range(x):\n ans.append(p[-1-i])\nfor i in range(y):\n ans.append(q[-1-i])\nans.sort()\nfor i in range(r):\n if ans[i]<=r[-1-rcount]:\n ans[i]=r[-1-rcount]\n rcount+=1\nprint(sum(ans))\n ', 'x,y,a,b,c=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\np.sort()\nq.sort()\nr.sort(reverse=True)\npcount=0\nqcount=0\nrcount=0\nans=[]\nfor i in range(x):\n ans.append(p[-1-i])\nfor i in range(y):\n ans.append(q[-1-i])\nans.sort()\nprint(ans,r)\nfor i in range(c):\n if ans[i]<=r[rcount]:\n ans[i]=r[rcount]\n rcount+=1\nprint(sum(ans))', 'x,y,a,b,c=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\n\np.sort(reverse=True)\nq.sort(reverse=True)\nans=[]\nfor i in range(x):\n r.append(p[i])\nfor i in range(y):\n r.append(q[i])\nr.sort(reverse=True)\nprint(sum(r[0:x+y]))\n \n\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s259234651', 's298486001', 's316926076', 's978078478', 's890668078']
[22720.0, 22720.0, 22720.0, 24552.0, 29536.0]
[310.0, 270.0, 264.0, 305.0, 172.0]
[410, 390, 390, 406, 302]
p02727
u020449748
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['[X, Y, A, B, C] = list(map(int, input().split()))\n\np = sorted(list(map(int, input().split())), reverse=True)\nq = sorted(list(map(int, input().split())), reverse=True)\nr = sorted(list(map(int, input().split())), reverse=True)\n\neatCandi = p[0:X] + q[0:Y] + r[0:X+Y]\nprint(sum(eatCandi[0:X+Y]))', '[X, Y, A, B, C] = list(map(int, input().split()))\n\np = sorted(list(map(int, input().split())), reverse=True)\nq = sorted(list(map(int, input().split())), reverse=True)\nr = sorted(list(map(int, input().split())), reverse=True)\n\neatCandi = sorted(p[0:X] + q[0:Y] + r[0:X+Y], reverse=True)\n\nprint(sum(eatCandi[0:X+Y]))\n']
['Wrong Answer', 'Accepted']
['s006746774', 's292620211']
[23200.0, 23200.0]
[210.0, 250.0]
[291, 315]
p02727
u022979415
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
["def main():\n x, y, a, b, c = map(int, input().split())\n p = list(map(int, input().split()))\n q = list(map(int, input().split()))\n r = list(map(int, input().split()))\n p.sort()\n q.sort()\n for i in range(-1, -x - 1, -1):\n r.append(p[i])\n for i in range(-1, -y - 1, -1):\n r.append(q[i])\n r.sort(reverse=True)\n print(sum(r[x + y:]))\n\n\nif __name__ == '__main__':\n main()\n\n", "def main():\n x, y, a, b, c = map(int, input().split())\n p = list(map(int, input().split()))\n q = list(map(int, input().split()))\n r = list(map(int, input().split()))\n p.sort()\n q.sort()\n for i in range(-1, -x - 1, -1):\n r.append(p[i])\n for i in range(-1, -y - 1, -1):\n r.append(q[i])\n r.sort(reverse=True)\n print(sum(r[:x + y]))\n\n\nif __name__ == '__main__':\n main()\n\n"]
['Wrong Answer', 'Accepted']
['s289848536', 's015215503']
[23328.0, 23328.0]
[249.0, 239.0]
[414, 414]
p02727
u025287757
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\n\nA = sorted(A)\nB = sorted(B)\n\nA = A[len(A)-x:]\nB = B[len(B)-y:]\nC = list(map(lambda x: x*(-1), C))\n\nimport heapq\nheapq.heapify(A)\nheapq.heapify(B)\nheapq.heapify(C)\n\nflag = True\nwhile flag:\n a = heapq.heappop(A)\n b = heapq.heappop(B)\n c = heapq.heappop(C)*(-1)\n if c < a and c < b:\n flag = False\n else:\n if a-c > b-c:\n heapq.heappush(A, c)\n heapq.heappush(B, b)\n if not C:\n break\n else:\n heapq.heappush(A, a)\n heapq.heappush(B, c)\n if not C:\n break\nprint(sum(A) + sum())', 'x, y, a, b, c = map(int, input().split())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\n\nA = sorted(A)\nB = sorted(B)\n\nA = A[len(A)-x:]\nB = B[len(B)-y:]\nC = list(map(lambda x: x*(-1), C))\n\nimport heapq\nheapq.heapify(A)\nheapq.heapify(B)\nheapq.heapify(C)\n\nflag = True\nwhile flag:\n a = heapq.heappop(A)\n b = heapq.heappop(B)\n c = heapq.heappop(C)*(-1)\n if c < a and c < b:\n heapq.heappush(A, a)\n heapq.heappush(B, b)\n flag = False\n else:\n if a > b:\n heapq.heappush(A, a)\n heapq.heappush(B, c)\n if not C:\n break\n else:\n heapq.heappush(A, c)\n heapq.heappush(B, b)\n if not C:\n break\nprint(sum(A) + sum(B))']
['Runtime Error', 'Accepted']
['s049881760', 's141559810']
[22720.0, 23328.0]
[450.0, 473.0]
[677, 724]
p02727
u025463382
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['from collections import deque\nx,y,a,b,c = map(int,input().split())\nred = [int(i) for i in input().split()]\ngw = [int(i) for i in input().split()] + [int(i) for i in input().split()]\nred.sort()\ngw.sort()\ngwrui = []\nrui = 0\nfor i in range(b+c):\n rui += gw[i]\n gwrui.append(rui)\nredq = deque(red[:x])\nans = 0\noisr = 0\nfor i in range(1,x+1):\n oisr += redq.popleft()\n temp = oisr\n temp += gwrui[x+y-i]\n ans = max(ans,temp)\nprint(ans)', 'from collections import deque\nx,y,a,b,c = map(int,input().split())\nred = [int(i) for i in input().split()]\ng = [int(i) for i in input().split()]\nw = [int(i) for i in input().split()]\nred.sort(reverse=True)\ng.sort(reverse=True)\ng = g[:y]\ngw = g+w\ngw.sort(reverse=True)\ngwrui = []\nrui = 0\nfor i in range(y+c):\n rui += gw[i]\n gwrui.append(rui)\nred = red[:x]\nrrui = []\nrui = 0\nfor i in range(x):\n rui += red[i]\n rrui.append(rui)\nrrui = [0] + rrui\nans = 0\noisr = 0\nlgw = len(gw)\n\nfor i in range(0,x+1):\n temp = rrui[i]\n if x+y-i <= lgw:\n temp += gwrui[x+y-i-1]\n ans = max(ans,temp)\nprint(ans)']
['Runtime Error', 'Accepted']
['s957014682', 's684520753']
[26704.0, 31784.0]
[368.0, 363.0]
[446, 639]
p02727
u037430802
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import heapq\n\n\nX,Y,A,B,C = map(int, input().split())\nP = list(map(int, input().split()))\nQ = list(map(int, input().split()))\nR = list(map(int, input().split()))\n\nr = []\ng = []\nnc = []\nfor p in P:\n heapq.heappush(r, -p)\n\nfor q in Q:\n heapq.heappush(g, -q)\n\nfor i in R:\n heapq.heappush(nc, -i)\n\nans = 0\n#print(r,g,nc)\nwhile X > 0 or Y > 0:\n\n\n if X > 0 and Y > 0:\n if len(nc) > 0 and r[0] < nc[0]:\n ans += -1 * r[0]\n heapq.heappop(r)\n X -= 1\n\n elif len(nc) > 0 and g[0] < nc[0]:\n ans += -1 * g[0]\n heapq.heappop(g)\n Y -= 1\n else:\n if len(nc) > 0 and abs(nc[0] - r[0]) >= abs(nc[0] - g[0]):\n ans += -1 * nc[0]\n heapq.heappop(nc)\n X -= 1\n elif len(nc) > 0 and abs(nc[0] - r[0]) < abs(nc[0] - g[0]):\n ans += -1 * nc[0]\n heapq.heappop(nc)\n Y -= 1\n else:\n if r[0] < g[0]:\n ans += -1 * r[0]\n heapq.heappop(r)\n X -= 1\n else:\n ans += -1 * g[0]\n heapq.heappop(g)\n Y -= 1\n \n elif X > 0:\n if len(nc) > 0 and r[0] < nc[0]:\n ans += -1 * r[0]\n heapq.heappop(r)\n X -= 1\n\n elif len(nc) > 0 and r[0] >= nc[0]:\n ans += -1 * nc[0]\n heapq.heappop(nc)\n X -= 1\n elif :\n ans += -1 * r[0]\n heapq.heappop(r)\n X -= 1\n else:\n if len(nc) > 0 and g[0] < nc[0]:\n ans += -1 * g[0]\n heapq.heappop(g)\n Y -= 1\n\n elif len(nc) > 0 and g[0] >= nc[0]:\n ans += -1 * nc[0]\n heapq.heappop(nc)\n Y -= 1\n elif :\n ans += -1 * g[0]\n heapq.heappop(g)\n Y -= 1\n \n\nprint(ans)', '\n\n\nX,Y,A,B,C = map(int, input().split())\n\nP = list(map(int, input().split()))\nQ = list(map(int, input().split()))\nR = list(map(int, input().split()))\n\nred_green = [(p, "r") for p in P] + [(q, "g") for q in Q]\nred_green.sort()\nnc = R\nnc.sort()\n\ncnt_r , cnt_g , cnt_n = 0,0,0\n\nans = 0\nwhile cnt_r + cnt_g + cnt_n < X + Y:\n\n \n if cnt_r == X:\n while red_green[-1][1] == "r":\n red_green.pop()\n if cnt_g == Y:\n while red_green[-1][1] == "g":\n red_green.pop()\n\n \n if len(nc) > 0 and nc[-1] > red_green[-1][0]:\n point = nc.pop()\n ans += point\n cnt_n += 1\n else:\n point, color = red_green.pop()\n ans += point\n if color == "r":\n cnt_r += 1\n else:\n cnt_g += 1\n\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s562470416', 's539903804']
[3064.0, 31052.0]
[18.0, 546.0]
[1957, 892]
p02727
u038408819
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\nans = p[:x] + q[:y] + r\nprint(sum(ans.sort(reverse=True)[:x + y]))', 'x, y, a, b, c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\nans = p[:x] + q[:y] + r\nprint(sum(sorted(ans, reverse=True)[:x + y]))\n']
['Runtime Error', 'Accepted']
['s600087569', 's028984789']
[23328.0, 23328.0]
[248.0, 241.0]
[279, 283]
p02727
u042802884
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import heapq as hq\n\nX, Y, A, B, C = map(int,input().split())\np = list(map(int,input().split())); p.sort(); p.reverse()\nq = list(map(int,input().split())); q.sort(); q.reverse()\nr = list(map(int,input().split())); r.sort(); r.reverse()\n\npq1 = []; hq.heapify(pq1) \nfor i in range(X):\n hq.heappush(pq1, p[i])\nfor i in range(Y):\n hq.heappush(pq1, q[i])\npq2 = []; hq.heapify(pq2) \nfor i in range(C):\n hq.heappush(pq2, -r[i])\nwhile (pq1[0] < -pq2[0]):\n hq.heappush(pq1, -hq.heappop(pq2))\n hq.heappop(pq1) \nprint(sum(pq1))', 'import heapq as hq\n\nX, Y, A, B, C = map(int,input().split())\np = list(map(int,input().split())); p.sort(); p.reverse()\nq = list(map(int,input().split())); q.sort(); q.reverse()\nr = list(map(int,input().split())); r.sort(); r.reverse()\n\npq1 = []; hq.heapify(pq1) \nfor i in range(X):\n hq.heappush(pq1, p[i])\nfor i in range(Y):\n hq.heappush(pq1, q[i])\npq2 = []; hq.heapify(pq2) \nfor i in range(C):\n hq.heappush(pq2, -r[i])\nwhile (len(pq2) and pq1[0] < -pq2[0]):\n hq.heappush(pq1, -hq.heappop(pq2))\n hq.heappop(pq1) \nprint(sum(pq1))']
['Runtime Error', 'Accepted']
['s470909763', 's652296628']
[23360.0, 23216.0]
[405.0, 443.0]
[584, 597]
p02727
u064434060
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['#import sys\n#import numpy as np\nimport math\n#from fractions import Fraction\nimport itertools\nfrom collections import deque\nfrom collections import Counter\n#import heapq\n#from fractions import gcd\n#input=sys.stdin.readline\nimport bisect\nx,y,a,b,c=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\nansp=p[:x]\nansq=q[:y]\nans=sum(ansp)+sum(ansq)\nep=x-1\neq=y-1\nprint(ans,sum(ansp),sum(ansq))\nfor i in range(c):\n if ep<0 and eq<0:\n break\n if (ep>=0 and eq<0) or (ep>=0 and eq>=0 and ansp[ep]<ansq[eq]):\n if ansp[ep]<r[i]:\n ans=ans-ansp[ep]+r[i]\n ep-=1 \n else:\n break\n elif (eq>=0 and ep<0) or (ep>=0 and eq>=0 and ansp[ep]<ansq[eq]):\n if ansq[eq]<r[i]:\n ans=ans-ansq[eq]+r[i]\n eq-=1\n print(ans,ep,eq)\nprint(ans)', '#import sys\n#import numpy as np\nimport math\n#from fractions import Fraction\nimport itertools\nfrom collections import deque\nfrom collections import Counter\n#import heapq\n#from fractions import gcd\n#input=sys.stdin.readline\nimport bisect\nx,y,a,b,c=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\nansp=p[:x]\nansq=q[:y]\nans=sum(ansp)+sum(ansq)\nep=x-1\neq=y-1\nfor i in range(c):\n if ep<0 and eq<0:\n break\n if (ep>=0 and eq<0) or (ep>=0 and eq>=0 and ansp[ep]<ansq[eq]):\n if ansp[ep]<r[i]:\n ans=ans-ansp[ep]+r[i]\n ep-=1 \n else:\n break\n elif (eq>=0 and ep<0) or (ep>=0 and eq>=0 and ansq[eq]<=ansp[ep]):\n if ansq[eq]<r[i]:\n ans=ans-ansq[eq]+r[i]\n eq-=1\n else:\n break\nprint(ans)']
['Wrong Answer', 'Accepted']
['s042082388', 's413554131']
[29516.0, 29448.0]
[264.0, 204.0]
[938, 917]
p02727
u078181689
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n', 'x,y,a,b,c = list(map(int,input().split()))\nparr = list(map(int,input().split()));parr.sort(reverse=True);parr = parr[:x]\nqarr = list(map(int,input().split()));qarr.sort(reverse=True);qarr = qarr[:y]\nrarr = list(map(int,input().split()))\narr = parr+qarr+rarr\narr.sort(reverse=True)\nprint(sum(arr[:x+y]))']
['Runtime Error', 'Accepted']
['s098849948', 's827562316']
[2940.0, 22528.0]
[17.0, 240.0]
[42, 302]
p02727
u088115428
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c = map(int, input().split())\np1 = list(map(int, input().split()))\np2 = list(map(int, input().split()))\np3 = list(map(int, input().split()))\nans1 = 0\nans2 = 0\np1.sort(reverse = True)\np2.sort(reverse = True)\np3.sort(reverse = True)\nfor i in range(0, max(x,y)):\n p3.append(0)\nfor i in range(0,x):\n ans1= ans1 + max(p1[i],p3[i])\n if(p3[i]>p1[i]):\n del p[i]\nfor i in range(0,y):\n ans2= ans2 + max(p2[i],p3[i])\n if(p3[i]>p2[i]):\n del p3[i]\nprint(ans1+ans2)\n\n', 'x,y,a,b,c = map(int, input().split())\np1 = list(map(int, input().split()))\np2 = list(map(int, input().split()))\np3 = list(map(int, input().split()))\np1.sort(reverse= True)\np2.sort(reverse= True)\nans =p1[:x]+p2[:y]+p3\nans.sort(reverse= True)\nprint(sum(ans[:x+y]))']
['Runtime Error', 'Accepted']
['s885681049', 's505503858']
[22720.0, 23328.0]
[286.0, 241.0]
[472, 262]
p02727
u091051505
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\np = [int(i) for i in input().split()]\nq = [int(i) for i in input().split()]\nr = [int(i) for i in input().split()]\n\np = list(reversed(sorted(p)))\nq = list(reversed(sorted(q)))\nr = list(reversed(sorted(r)))\np_cum = [0]\nq_cum = [0]\nr_cum = [0]\nfor i in range(a):\n p_cum.append(p_cum[i] + p[i])\nfor i in range(b):\n q_cum.append(q_cum[i] + q[i])\nfor i in range(c):\n r_cum.append(r_cum[i] + r[i])\nans = 0\nfor i in range(0, min(c, a) + 1):\n for j in range(0, min(c - i, b) + 1):\n print(x-i, y-j, i+j)\n ans = max(ans, p_cum[x - i] + q_cum[y - j] + r_cum[i + j])\nprint(ans)', 'x, y, a, b, c = map(int, input().split())\np = [int(i) for i in input().split()]\nq = [int(i) for i in input().split()]\nr = [int(i) for i in input().split()]\n\np = list(reversed(sorted(p)))\nq = list(reversed(sorted(q)))\nr = list(reversed(sorted(r)))\napple = p[:x] + q[:y] + r\napple = list(reversed(sorted(apple)))\nprint(sum(apple[:x+y]))']
['Wrong Answer', 'Accepted']
['s766211178', 's149903885']
[45700.0, 25264.0]
[2105.0, 266.0]
[632, 334]
p02727
u093861603
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C=map(int,input().split())\nP=list(map(int,input().split()))\nQ=list(map(int,input().split()))\nR=list(map(int,input().split()))\nP.sort(reverse=True)\nQ.sort(reverse=True)\nR.sort(reverse=True)\n\nans=sum(P[:X]+Q[:Y])\nr,g,f=X,Y,0\nwhile (R[f]>P[r] or R[f]>Q[g]) and r>=0 and g>=0 and f<C:\n if P[r]<Q[g]:\n ans=ans-P[r]+R[f]\n r-=1\n f+=1\n else:\n ans=ans-Q[g]+R[f]\n g-=1\n f+=1\nprint(ans)\n\n', 'X,Y,A,B,C=map(int,input().split())\nP=list(map(int,input().split()))\nQ=list(map(int,input().split()))\nR=list(map(int,input().split()))\nP.sort(reverse=True)\nQ.sort(reverse=True)\nR.sort(reverse=True)\nP.append(float("inf"))\nQ.append(float("inf"))\nans=sum(P[:X]+Q[:Y])\nrfinish=False\ngfinish=False\nr,g,f=X-1,Y-1,0\nwhile f<C and (R[f]>P[r] or R[f]>Q[g]):\n if P[r]<Q[g]:\n ans=ans-P[r]+R[f]\n r-=1\n f+=1\n else:\n ans=ans-Q[g]+R[f]\n g-=1\n f+=1\nprint(ans)\n\n']
['Runtime Error', 'Accepted']
['s557340889', 's303277261']
[23328.0, 23328.0]
[296.0, 271.0]
[433, 492]
p02727
u095021077
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
["import sys\nsys.setrecursionlimit(10**8)\n\nN, X, Y=map(int, input().split())\nans=[0 for _ in range(N)]\nlink=[[]]+[[2]]+[[i-1, i+1] for i in range(2, N)]+[[N-1]]\nlink[X].append(Y)\nlink[Y].append(X)\n\ndef f(p, length, moto):\n ans[length]+=1\n for data in link[p]:\n if data!=moto:\n f(data, length+1, p)\n \nfor i in range(1, N+1):\n for data in link[i]:\n f(data, 1, i)\n \nprint(*ans[1:], sep='\\n')", 'X, Y, A, B, C=map(int, input().split())\np=list(map(int, input().split()))\np.sort()\nq=list(map(int, input().split()))\nq.sort()\nr=list(map(int, input().split()))\nr.sort(reverse=True)\n\ni=-X\nj=-Y\nk=0\nderu=0\nwhile deru=0 and k<C and (r[k]>p[i] or r[k]>q[j]):\n if p[i]>q[j] and j<0:\n j+=1\n k+=1\n elif p[i]>q[j] and j>=0 and i<0:\n i+=1\n k+=1\n elif p[i]<q[j] and i<0:\n i+=1\n k+=1\n elif p[i]<q[j] and i>=0 and j<0:\n j+=1\n k+=1\n else:\n deru=1\n \nif i==0:\n a=0\nelse:\n a=sum(p[i:])\n \nif j==0:\n b=0\nelse:\n b=sum(q[j:])\n \nif k==0:\n c=0\nelse:\n c=sum(r[:k])\n \nprint(a+b+c)', 'X, Y, A, B, C=map(int, input().split())\np=list(map(int, input().split()))\nq=list(map(int, input().split()))\nr=list(map(int, input().split()))\np.sort()\nq.sort()\nnums=p[-X:]+q[-Y:]+r\nnums.sort()\nprint(sum(nums[-(X+Y):]))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s182640806', 's910162771', 's554737632']
[3064.0, 3060.0, 23328.0]
[17.0, 18.0, 233.0]
[408, 599, 218]
p02727
u100572972
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C = map(int,input().split())\nP = list(map(int, input().split()))\nQ = list(map(int, input().split()))\nR = list(map(int, input().split()))\n\nP_up = P[-X:]\nQ_up = Q[-Y:]\n\nP_up.append(Q_up)\nP_up.extend(R)\n\nP_up.sort()\na=-(X+Y)\nprint(sum(P_up[a:]))', 'X,Y,A,B,C = map(int,input().split())\nP = list(map(int, input().split()))\nQ = list(map(int, input().split()))\nR = list(map(int, input().split()))\n\nR+=sorted(P)[-X:]\nR+=sorted(Q)[-Y:]\n\na=-(X+Y)\nprint(sum(sorted(R)[a:]))\n']
['Runtime Error', 'Accepted']
['s301401264', 's849010070']
[22560.0, 23328.0]
[115.0, 235.0]
[250, 218]
p02727
u102461423
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['#!/usr/bin/ python3.8\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\nm = map(int, read().split())\nAB = zip(m, m)\n\nMOD = 10 ** 9 + 7\n\ngraph = [[] for _ in range(N + 1)]\nfor a, b in AB:\n graph[a].append(b)\n graph[b].append(a)\n\nroot = 1\nparent = [0] * (N + 1)\norder = []\nstack = [root]\nwhile stack:\n x = stack.pop()\n order.append(x)\n for y in graph[x]:\n if y == parent[x]:\n continue\n parent[y] = x\n stack.append(y)\n\nfact = [1] * (N + 10)\nfor n in range(1, N + 10):\n fact[n] = n * fact[n - 1] % MOD\nfact_inv = [1] * (N + 10)\nfact_inv[-1] = pow(fact[-1], MOD - 2, MOD)\nfor n in range(N + 9, 0, -1):\n fact_inv[n - 1] = fact_inv[n] * n % MOD\n\nsize_d = [0] * (N + 1)\ndp_d = [1] * (N + 1)\n\nfor v in order[::-1]:\n dp_d[v] *= fact[size_d[v]]\n dp_d[v] %= MOD\n p = parent[v]\n s = size_d[v] + 1\n size_d[p] += s\n dp_d[p] *= fact_inv[s] * dp_d[v]\n dp_d[p] %= MOD\n\nsize_u = [N - 2 - x for x in size_d]\ndp_u = [1] * (N + 1)\n\nfor v in order[1:]:\n p = parent[v]\n x = dp_d[p]\n x *= dp_u[p]\n x *= fact_inv[size_d[p]]\n x *= fact[size_d[v] + 1]\n x *= pow(dp_d[v], MOD - 2, MOD)\n x *= fact[size_u[v]]\n x *= fact_inv[size_u[p] + 1]\n dp_u[v] = x % MOD\n\nfor xd, xu, sd, su in zip(dp_d[1:], dp_u[1:], size_d[1:], size_u[1:]):\n su += 1\n x = xd * xu * fact[sd + su] * fact_inv[sd] * fact_inv[su] % MOD\n print(x)\n', '#!/usr/bin/ python3.8\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nX, Y, A, B, C = map(int, readline().split())\nP = sorted(map(int, readline().split()), reverse=True)\nQ = sorted(map(int, readline().split()), reverse=True)\nR = sorted(map(int, readline().split()), reverse=True)\n\nP = P[:X]\nQ = Q[:Y]\nnums = P + Q + R\nnums.sort(reverse=True)\nanswer = sum(nums[:X + Y])\nprint(answer)\n']
['Runtime Error', 'Accepted']
['s744842342', 's180720111']
[3192.0, 21088.0]
[18.0, 246.0]
[1481, 452]
p02727
u103724957
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
["val = input().split(' ')\nx = int(val[0])\ny = int(val[1])\na = int(val[2])\nb = int(val[3])\nc = int(val[4])\n\np_list = sorted([int(a) for a in input().split(' ')]).reverse()\nq_list = sorted([int(a) for a in input().split(' ')]).reverse()\nr_list = sorted([int(a) for a in input().split(' ')]).reverse()\n\nxapples = p_list[0:x+1]\nyapples = q_list[0:y+1]\nzapples = r_list[0:x+y+1]\n\napples = sorted(xapples.extend(yapples).extend(zapples)).reverse()[0:x+y+1]\nprint(sum(apples))\n", "val = input().split(' ')\nx = int(val[0])\ny = int(val[1])\na = int(val[2])\nb = int(val[3])\nc = int(val[4])\n \np_list = sorted([int(a) for a in input().split(' ')])\nq_list = sorted([int(a) for a in input().split(' ')])\nr_list = sorted([int(a) for a in input().split(' ')])\np_list.reverse()\nq_list.reverse()\nr_list.reverse()\n \nxapples = p_list[0:x]\nyapples = q_list[0:y]\nzapples = r_list[0:x+y]\n \nxapples.extend(yapples)\nxapples.extend(zapples)\ntmp_apples = sorted(xapples)\ntmp_apples.reverse()\napples = tmp_apples[0:x+y]\nprint(sum(apples))\n"]
['Runtime Error', 'Accepted']
['s860412934', 's694965633']
[15440.0, 24972.0]
[203.0, 264.0]
[469, 536]
p02727
u105124953
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c = map(int,input().split())\npl = list(map(int,input().split()))\nql = list(map(int,input().split()))\nrl = list(map(int,input().split()))\n\npp = sorted(pl,reverse=True)[:x-1]\nqq = sorted(pl,reverse=True)[:y-1]\nall = pp + qq + rl\nprint(sum(sorted(pl,reverse=True)[:x+y-1]))', 'import heapq\nx,y,a,b,c = map(int,input().split())\npl = list(map(int,input().split()))\nql = list(map(int,input().split()))\nrl = list(map(int,input().split()))\n\npp = sorted(pl,reverse=True)[:x]\nqq = sorted(ql,reverse=True)[:y]\nal = pp + qq + rl\n#print(al,pp,qq,rl)\nprint(sum(sorted(al,reverse=True)[:x+y]))']
['Wrong Answer', 'Accepted']
['s276697937', 's787529209']
[22720.0, 24240.0]
[212.0, 240.0]
[278, 304]
p02727
u112629957
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C=map(int,input().split())\nls_a=sorted(list(map(int,input().split())))\nls_b=sorted(list(map(int,input().split())))\nls_c=sorted(list(map(int,input().split())))\nls_x=ls_a[A-X:A]\nls_y=ls_b[B-Y:B]\nls_c.reverse()\n\nans=sum(ls_x)+sum(ls_y)\na=b=c=0\nfor _ in range(X+Y):\n if a==len(ls_x):\n m=min([ls_y[b],ls_c[c]])\n if m==ls_y[b]:\n ans+=(-ls_y[b]+ls_c[c])\n b+=1\n c+=1\n else:\n break\n elif b==len(ls_y):\n m=min([ls_x[a],ls_c[c]])\n if m==ls_x[a]:\n ans+=(-ls_x[a]+ls_c[c])\n a+=1\n c+=1\n else:\n break\n else: \n m=min([ls_x[a],ls_y[b],ls_c[c]])\n if m==ls_x[a]:\n ans+=(-ls_x[a]+ls_c[c])\n a+=1\n c+=1\n elif m==ls_y[b]:\n ans+=(-ls_y[b]+ls_c[c])\n b+=1\n c+=1\n else:\n break\nprint(ans)', 'X,Y,A,B,C=map(int,input().split())\nls_a=list(map(int,input().split()))\nls_b=list(map(int,input().split()))\nls_c=list(map(int,input().split()))\n\nls_a.sort(reverse=True)\nls_b.sort(reverse=True)\nls_c.sort(reverse=True)\n\nls=sorted(ls_a[:X]+ls_b[:Y])\nans=sum(ls)\nfor i in range(min(X+Y, C)):\n if ls[i] < ls_c[i]:\n ans += ls_c[i] - ls[i]\nprint(ans)']
['Runtime Error', 'Accepted']
['s621755854', 's897646338']
[22720.0, 23328.0]
[321.0, 248.0]
[779, 352]
p02727
u134520518
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np =sorted(p)[::-1][:x][::-1]\nq =sorted(q)[::-1][:y][::-1]\nr =sorted(r)[::-1][:x+y]\n\npp = 0\nqq = 0\npf = True\nqf = True\nfor rr in r:\n lll = False\n if pf == True and qf == True:\n if p[pp]<rr and q[qq]<rr:\n lll = True\n if p[pp]<q[qq] and pf == True:\n p[pp] = rr\n pp += 1\n if pp == x:\n pf = False\n elif qf == True:\n q[qq] = rr\n qq +=1\n if qq == y:\n qf = False\n if pf == True and lll == False:\n lll = True\n if p[pp]<rr:\n if pf == True:\n p[pp] = rr\n pp += 1\n if pp == x:\n pf = False\n if pf == True and lll == False:\n lll = True\n if q[qq]<rr:\n if qf == True:\n q[qq] = rr\n qq +=1\n if qq == y:\n qf = False\nprint(sum(p)+sum(q))', 'x,y,a,b,c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np =sorted(p)[::-1][:x][::-1]\nq =sorted(q)[::-1][:y][::-1]\nr =sorted(r)[::-1][:x+y]\n\npp = 0\nqq = 0\npf = True\nqf = True\nfor rr in r:\n lll = False\n if pf == True and qf == True:\n if p[pp]<rr and q[qq]<rr:\n lll = True\n if p[pp]<q[qq] and pf == True:\n p[pp] = rr\n pp += 1\n if pp == x:\n pf = False\n elif qf == True:\n q[qq] = rr\n qq +=1\n if qq == y:\n qf = False\n if pf == True and lll == False:\n if p[pp]<rr:\n lll = True\n if pf == True:\n p[pp] = rr\n pp += 1\n if pp == x:\n pf = False\n if qf == True and lll == False:\n if q[qq]<rr:\n lll = True\n if qf == True:\n q[qq] = rr\n qq +=1\n if qq == y:\n qf = False\n\nprint(sum(p)+sum(q))']
['Wrong Answer', 'Accepted']
['s601226406', 's980978379']
[23328.0, 23328.0]
[294.0, 292.0]
[1116, 1125]
p02727
u135847648
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['def main():\n x, y, a, b, c = map(int, input().split())\n P = list(map(int, input().split()))\n Q = list(map(int, input().split()))\n R = list(map(int, input().split()))\n P.sort(reverse=True)\n Q.sort(reverse=True)\n R.sort(reverse=True)\n\n s = P[:x] + Q[:y]\n s.sort()\n for i in range(x + y):\n if s[i] < R[i]:\n s[i] = R[i]\n else:\n break\n print(sum(s))\n\nif __name__ == "__main__":\n main()\n', 'def main():\n x, y, a, b, c = map(int, input().split())\n P = list(map(int, input().split()))\n Q = list(map(int, input().split()))\n R = list(map(int, input().split()))\n t = [1]\n t.sort()\n P.sort(reverse=True)\n Q.sort(reverse=True)\n R.sort(reverse=True)\n\n s = P[:x] + Q[:y]\n s.sort()\n for i in range(x + y):\n if s[i] < R[i] and i < c:\n s[i] = R[i]\n else:\n break\n print(sum(s))\n\nif __name__ == "__main__":\n main()\n', 'def main():\n x, y, a, b, c = map(int, input().split())\n P = list(map(int, input().split()))\n Q = list(map(int, input().split()))\n R = list(map(int, input().split()))\n t = [1]\n t.sort()\n P.sort(reverse=True)\n Q.sort(reverse=True)\n R.sort(reverse=True)\n\n s = P[:x] + Q[:y]\n s.sort()\n for i in range(x + y):\n if i < c:\n if s[i] < R[i]:\n s[i] = R[i]\n else:\n break\n else:\n break\n print(sum(s))\n\n\nif __name__ == "__main__":\n main()\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s411960950', 's718136429', 's553754883']
[23328.0, 23328.0, 23328.0]
[229.0, 238.0, 220.0]
[453, 488, 545]
p02727
u146575240
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['#E - Red and Green Apples\nX,Y,A,B,C= map(int, input().split())\na =sorted(list(map(int, input().split())),reverse=True)\nb =sorted(list(map(int, input().split())),reverse=True)\nc =sorted(list(map(int, input().split())),reverse=True)\n\nDP_a =[]\nDP_b =[]\nj = 1\nk = 1\na_s =sum(a[:X])\nb_s =sum(b[:Y])\n\nfor i in range(C):\n if c[i] > a[X-j] or c[i] > b[Y-k]:\n if c[i] > a[X-j] and a[X-j] > b[Y-k]:\n j += 1\n if j > X:\n DP_a.append(c[i])\n else:\n pass\n elif c[i] > b[Y-k] and b[Y-k] >= a[X-j]:\n if k > Y:\n DP_b.append(c[i])\n else:\n pass\n else:\n pass\n else:\n break\n\na_s = a_s-sum(a[X-len(DP_a):X])+sum(DP_a)\nb_s = b_s-sum(b[Y-len(DP_b):Y])+sum(DP_b)\n\n\nprint(a_s+b_s)\n', '#E - Red and Green Apples\nX,Y,A,B,C= map(int, input().split())\na =sorted(list(map(int, input().split())),reverse=True)\nb =sorted(list(map(int, input().split())),reverse=True)\nc =sorted(list(map(int, input().split())),reverse=True)\nprint(a,b,c)\nDP_a =[]\nDP_b =[]\nj = 1\nk = 1\na_s =sum(a[:X])\nb_s =sum(b[:Y])\n\nfor i in range(C):\n if c[i] > a[X-j] or c[i] > b[Y-k]:\n if c[i] > a[X-j] and a[X-j] > b[Y-k]:\n j += 1\n if j >= X:\n DP_a.append(c[i])\n else:\n pass\n elif c[i] > b[Y-k] :\n k += 1\n if k >= Y:\n DP_b.append(c[i])\n else:\n pass\n else:\n pass\n else:\n break\n\na_s = a_s-sum(a[X-len(DP_a):X])+sum(DP_a)\nb_s = b_s-sum(b[Y-len(DP_b):Y])+sum(DP_b)\n\n\nprint(a_s+b_s)', '#E - Red and Green Apples\nX,Y,A,B,C= map(int, input().split())\na =sorted(list(map(int, input().split())),reverse=True)\nb =sorted(list(map(int, input().split())),reverse=True)\nc =sorted(list(map(int, input().split())),reverse=True)\nDP_a =a[:X]\nDP_b =b[:Y]\nDP_a.extend(DP_b)\nDP_a.extend(c)\nans = sorted(DP_a,reverse=True)\nprint(sum(ans[:X+Y]))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s388649131', 's547178350', 's757149444']
[23472.0, 24096.0, 24244.0]
[295.0, 321.0, 257.0]
[814, 826, 341]
p02727
u149752754
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, al, bl, cl = map(int, input().split())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nam = x-1\nbm = y-1\ncm = 0\nwhile True:\n #print(am)\n #print(bm)\n #print(cm)\n if cm >= cl:\n break\n elif am == -1:\n if bm == -1:\n break\n else:\n if c[cm] > b[bm]:\n cm += 1\n bm -= 1\n else:\n break\n elif bm == -1:\n if c[cm] > a[am]:\n cm += 1\n am -= 1\n else:\n break\n elif (c[cm] <= a[am]) & (c[cm] <= b[bm]):\n break\n elif (c[cm] > a[am]) & (c[cm] <= b[bm]):\n cm += 1\n am -= 1\n elif (c[cm] <= a[am]) & (c[cm] > b[bm]):\n cm += 1\n bm -= 1\n else:\n if (c[cm]-a[am]) < (c[cm]-b[bm]):\n cm += 1\n bm -= 1\n else:\n cm += 1\n am -= 1\nans = 0\nif am != 0:\n for i in range(am+1):\n ans += a[i]\nif bm != 0:\n for j in range(bm+1):\n ans += b[j]\nif cm != 0:\n for k in range(cm):\n ans += c[k]\n\nprint(ans)', '#E\nx, y, al, bl, cl = map(int, input().split())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nam = x-1\nbm = y-1\ncm = 0\nwhile True:\n #print(am)\n #print(bm)\n #print(cm)\n if cm >= cl:\n break\n elif am == -1:\n if bm == -1:\n break\n else:\n if c[cm] > b[bm]:\n cm += 1\n bm -= 1\n else:\n break\n elif bm == -1:\n if c[cm] > a[am]:\n cm += 1\n am -= 1\n else:\n break\n elif (c[cm] <= a[am]) & (c[cm] <= b[bm]):\n break\n elif (c[cm] > a[am]) & (c[cm] <= b[bm]):\n cm += 1\n am -= 1\n elif (c[cm] <= a[am]) & (c[cm] > b[bm]):\n cm += 1\n bm -= 1\n else:\n if (c[cm]-a[am]) < (c[cm]-b[bm]):\n cm += 1\n bm -= 1\n else:\n cm += 1\n am -= 1\nans = 0\nif am != -1:\n for i in range(am+1):\n ans += a[i]\nif bm != -1:\n for j in range(bm+1):\n ans += b[j]\nif cm != 0:\n for k in range(cm):\n ans += c[k]\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s597146788', 's751672366']
[23328.0, 23116.0]
[422.0, 403.0]
[1187, 1192]
p02727
u161712560
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C = map(int, input().split())\n\npList = list(map(int, input().split()))\nqList = list(map(int, input().split()))\nrList = list(map(int, input().split()))\n\npList.sort(reverse=True)\nqList.sort(reverse=True)\nrList.sort(reverse=True)\n\npList = pList[:X]\nqList = qList[:Y]\n\nvalue = 0\n\nfor indx in range(X+Y):\n if (pList[0] > qList[0]) and (pList[0] > rList[0]):\n value += pList[0]\n pList.pop(0)\n\n if len(pList) == 0:\n pList.append(-1)\n\n elif (qList[0] > pList[0]) and (qList[0] > rList[0]):\n value += qList[0]\n qList.pop(0)\n\n if len(qList) == 0:\n qList.append(-1)\n\n # else:\n # value += rList[0]\n # rList.pop(0)\n\n # if len(rList) == 0:\n # rList.append(-1)\n\n\nprint(value)\n', 'X, Y, A, B, C = map(int, input().split())\n\npList = list(map(int, input().split()))\nqList = list(map(int, input().split()))\nrList = list(map(int, input().split()))\n\npList.sort()\nqList.sort()\nrList.sort()\n\npList = pList[:X]\nqList = qList[:Y]\n\nvalue = 0\n\nfor indx in range(X+Y):\n if (pList[len(pList)-1] > qList[len(qList)-1]) and (pList[len(pList)-1] > rList[len(rList)-1]):\n value += pList[len(pList)-1]\n pList.pop(len(pList)-1)\n\n if len(pList) == 0:\n pList.append(-1)\n\n elif (qList[len(qList)-1] > pList[len(pList)-1]) and (qList[len(qList)-1] > rList[len(rList)-1]):\n value += qList[len(qList)-1]\n qList.pop(len(qList)-1)\n\n if len(qList) == 0:\n qList.append(-1)\n\n else:\n value += rList[len(rList)-1]\n rList.pop(len(rList)-1)\n\n if len(rList) == 0:\n rList.append(-1)\n\n\nprint(value)\n', 'X, Y, A, B, C = map(int, input().split())\n\npList = list(map(int, input().split()))\nqList = list(map(int, input().split()))\nrList = list(map(int, input().split()))\n\npList.sort(reverse=True)\nqList.sort(reverse=True)\nrList.sort(reverse=True)\n\npList = pList[:X]\nqList = qList[:Y]\n\nappleList = pList + qList + rList\nappleList.sort(reverse=True)\nappleList = appleList[:X+Y]\n\nprint(sum(appleList))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s524645931', 's996908934', 's046996153']
[22720.0, 22720.0, 23328.0]
[1582.0, 469.0, 241.0]
[778, 886, 391]
p02727
u166340293
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\nx=0\ny=0\nR=0\nz=0\ns=0\nwhile (x<X or y<Y) and z<X+Y:\n if (max(p[0],q[0],r[0])==p[0] or (y==Y and r[0]<p[0])) and x<X:\n s+=p[0]\n x+=1\n p[0]=p[x]\n z+=1\n elif (max(p[0],q[0],r[0])==q[0] or (x==X and r[0]<q[0])) and y<Y:\n s+=q[0]\n y+=1\n q[0]=q[y]\n z+=1\n else:\n s+=r[0]\n R+=1\n r[0]=r[R]\n z+=1\nprint(s)', 'X,Y,A,B,C=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\nx=0\ny=0\nR=0\nz=0\ns=0\nwhile (x<X or y<Y) and z<X+Y:\n if (max(p[0],q[0],r[0])==p[0] or (y==Y and r[0]<p[0])) and x<X:\n s+=p[0]\n x+=1\n if x<A:\n p[0]=p[x]\n else:\n p[0]=0\n z+=1\n elif (max(p[0],q[0],r[0])==q[0] or (x==X and r[0]<q[0])) and y<Y:\n s+=q[0]\n y+=1\n if y<B:\n q[0]=q[y]\n else:\n q[0]=0\n z+=1\n else:\n s+=r[0]\n R+=1\n if R<C:\n r[0]=r[R]\n else:\n r[0]=0\n z+=1\nprint(s)']
['Runtime Error', 'Accepted']
['s285823176', 's815731937']
[23328.0, 23328.0]
[443.0, 458.0]
[529, 640]
p02727
u167943640
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
["x,y,a,b,c = list(map(int, input().split(' ')))\np = sorted(list(map(int, input().split(' '))))[-x:]\nq = sorted(list(map(int, input().split(' '))))[-y:]\nr = sorted(list(map(int, input().split(' '))))[-x-y:]\n\npidx = 0\nqidx = 0\nfor i in range(x+y):\n ptmp = 0\n qtmp = 0\n valid_p = True\n valid_q = True\n if pidx < a:\n \tptmp = p[pidx]\n else:\n valid_p = False\n if qidx < b:\n qtmp = q[qidx]\n else:\n valid_q = False\n sel_p = True \n if valid_q:\n if not valid_p:\n sel_p = False\n elif ptmp<qtmp:\n sel_p = False\n rtmp = r[c - 1 - i] \n if sel_p:\n if ptmp < rtmp and pidx < a:\n p[pidx] = rtmp\n pidx += 1\n else:\n if qtmp < rtmp and qidx < b:\n q[qidx] = rtmp\n qidx += 1\nprint (sum(p) + sum(q))", "x,y,a,b,c = list(map(int, input().split(' ')))\np = sorted(list(map(int, input().split(' '))))[-x:]\nq = sorted(list(map(int, input().split(' '))))[-y:]\nr = sorted(list(map(int, input().split(' '))))[-x-y:]\n\nz = sorted(p+q+r)[-x-y:]\n\nprint (sum(z))"]
['Runtime Error', 'Accepted']
['s301497884', 's397505848']
[22504.0, 22504.0]
[361.0, 251.0]
[760, 246]
p02727
u169138653
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\nlis=p[:x]+q[:y]+r\nlis.sort(reverse=True)\nans=0\nfor i in range(x+y):\n ans+=lis[i]\nprint(ans)', 'x,y,a,b,c=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\np.sort(reverse=True)\nq.sort(reverse=True)\nlis=p[:x]+q[:y]+r\nlis.sort(reverse=True)\nans=0\nfor i in range(x+y):\n ans+=lis[i]\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s145664859', 's942482494']
[23328.0, 23328.0]
[245.0, 254.0]
[226, 269]
p02727
u178465329
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['\nx,y,a,b,c = map(int, input().split())\nA = list(map(int, input().split())) \nB = list(map(int, input().split())) \nC = list(map(int, input().split())) \n\nA.sort()\nB.sort()\nC.sort(reverse=True)\n\nX = A[len(A)-x:]\nY = B[len(B)-y:]\n\nprint(X,Y,C)\n\nxi = 0\nyi = 0\nci = 0\nfor ci in range(c):\n if C[ci] <= X[xi] and C[ci] <= Y[yi]:\n break\n \n if X[xi] < Y[yi]:\n if C[ci] > X[xi]:\n X[xi] = C[ci]\n xi = xi + 1\n else:\n if C[ci] > Y[yi]:\n Y[yi] = C[ci]\n yi = yi + 1\n\nprint(X,Y)\nprint(sum(X)+sum(Y))\n\n\n\n\n', '\nx,y,a,b,c = map(int, input().split())\nA = list(map(int, input().split())) \nB = list(map(int, input().split())) \nC = list(map(int, input().split())) \n\nA.sort()\nB.sort()\nC.sort(reverse=True)\n\nX = A[len(A)-x:]\nY = B[len(B)-y:]\n\n#print(X,Y,C)\n\nxi = 0\nyi = 0\nci = 0\nfor ci in range(c):\n #print(ci,xi,yi)\n if xi < len(X) and yi < len(Y):\n if C[ci] <= X[xi] and C[ci] <= Y[yi]:\n break\n \n if X[xi] < Y[yi]:\n if C[ci] > X[xi]:\n X[xi] = C[ci]\n xi = xi + 1\n else:\n if C[ci] > Y[yi]:\n Y[yi] = C[ci]\n yi = yi + 1\n \n elif xi < len(X):\n if C[ci] <= X[xi]:\n break\n \n if C[ci] > X[xi]:\n X[xi] = C[ci]\n xi = xi + 1\n \n elif yi < len(Y):\n if C[ci] <= Y[yi]:\n break\n \n if C[ci] > Y[yi]:\n Y[yi] = C[ci]\n yi = yi + 1\n \n else:\n break\n\nprint(sum(X)+sum(Y))']
['Runtime Error', 'Accepted']
['s949394613', 's533991857']
[25412.0, 23328.0]
[327.0, 278.0]
[563, 1016]
p02727
u188138642
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import numpy as np\nX, Y, A, B, C = map(int,input().split())\nReds = list(map(int, input().split()))\nGreens = list(map(int, input().split()))\nNs = list(map(int, input().split()))\n\nReds = np.array(Reds)\nGreens = np.array(Greens)\nNs = np.array(Ns)\n\nReds = np.sort(Reds)[:X-1:-1]\nGreens = np.sort(Greens)[:Y-1:-1]\nNs = np.sort(Ns)[::-1]\n\nFull = np.append(Reds, Greens)\nFull = np.append(Full, Ns)\nFull = np.sort(Full)[::-1]\n\nsum = 0\n\nfor i in range(X+Y):\n sum += Full[i]\n\nprint(sum)', 'import numpy as np\nX, Y, A, B, C = map(int,input().split())\nReds = list(map(int, input().split()))\nGreens = list(map(int, input().split()))\nNs = list(map(int, input().split()))\n\nReds = np.array(Reds)\nGreens = np.array(Greens)\nNs = np.array(Ns)\n\nReds = np.sort(Reds)[::-1]\nGreens = np.sort(Greens)[::-1]\nNs = np.sort(Ns)[::-1]\n\nFull = np.append(Reds[:X], Greens[:Y])\nFull = np.append(Full, Ns)\nFull = np.sort(Full)[::-1]\n\nsum = 0\n\nfor i in range(X+Y):\n sum += Full[i]\n\nprint(sum)']
['Runtime Error', 'Accepted']
['s253242308', 's612176554']
[33172.0, 31320.0]
[320.0, 364.0]
[479, 481]
p02727
u199830845
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import sys\nsys.setrecursionlimit(10 ** 6) \nto_index = lambda x: int(x) - 1 \nprint_list_in_2D = lambda x: print(*x, sep="\\n") \n\n\ndef input_int(): return int(input())\n\ndef map_int_input(): return map(int, input())\n\nMII = map_int_input\n\ndef MII_split(): return map(int, input().split())\n\ndef MII_to_index(): return map(to_index, input())\n\ndef MII_split_to_index(): return map(to_index, input().split())\n\n\ndef list_int_inputs(): return list(map(int, input()))\n\nLII = list_int_inputs\n\ndef LII_split(): return list(map(int, input().split()))\n\n\ndef LII_2D(rows_number): return [LII() for _ in range(rows_number)]\n\ndef LII_split_2D(rows_number): return [LII_split() for _ in range(rows_number)]\n\nX, Y, A, B, C = MII_split()\np_list = LII_split()\nq_list = LII_split()\nr_list = LII_split()\n\nprices = p_list + q_list + r_list\nprices = prices.sort()\nprint(sum(prices[0:X + Y]))', 'import sys\nsys.setrecursionlimit(10 ** 6) \nto_index = lambda x: int(x) - 1 \nprint_list_in_2D = lambda x: print(*x, sep="\\n") \n\n\ndef input_int(): return int(input())\n\ndef map_int_input(): return map(int, input())\n\nMII = map_int_input\n\ndef MII_split(): return map(int, input().split())\n\ndef MII_to_index(): return map(to_index, input())\n\ndef MII_split_to_index(): return map(to_index, input().split())\n\n\ndef list_int_inputs(): return list(map(int, input()))\n\nLII = list_int_inputs\n\ndef LII_split(): return list(map(int, input().split()))\n\n\ndef LII_2D(rows_number): return [LII() for _ in range(rows_number)]\n\ndef LII_split_2D(rows_number): return [LII_split() for _ in range(rows_number)]\n\nX, Y, A, B, C = MII_split()\np_list = LII_split()\nq_list = LII_split()\nr_list = LII_split()\n\nprices = sorted(p_list, reverse=True)[0:X] + sorted(q_list, reverse=True)[0:Y] + r_list\nprices = sorted(prices, reverse=True)\n# print(prices)\nprint(sum(prices[0:X + Y]))']
['Runtime Error', 'Accepted']
['s721953147', 's392037972']
[23328.0, 23328.0]
[292.0, 252.0]
[1151, 1236]
p02727
u201878104
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['p = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\nIronMan = sorted(p)\nCaptainAmerica = sorted(q)\nfor i in range(X):\n r.append(IronMan.pop())\nfor i in range(Y):\n CaptainAmerica.append(q.pop())\nSpiderMan = sorted(r)[::-1]\nprint(sum(SpiderMan[:X+Y]))\n', 'p = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\nsorted(p)\nsorted(q)\nfor i in range(X):\n r.append(p.pop())\nfor i in range(Y):\n r.append(q.pop())\nSpiderMan = sorted(r)[::-1]\nprint(sum(SpiderMan[:X+Y]))\n', 'p = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\nsorted(p)\nsorted(q)\nfor i in range(X):\n r.append(p.pop())\nfor i in range(Y):\n r.append(q.pop())\nSpiderMan = sorted(r)[::-1]\nprint(sum(SpiderMan[:X+Y]))\n', 'X, Y, A, B, C = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\nIronMan = sorted(p)\nCaptainAmerica = sorted(q)\nfor i in range(X):\n r.append(IronMan.pop())\nfor i in range(Y):\n r.append(CaptainAmerica.pop())\nSpiderMan = sorted(r)[::-1]\nprint(sum(SpiderMan[:X+Y]))\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s497761344', 's712524735', 's878180861', 's391830551']
[19360.0, 20144.0, 20144.0, 25460.0]
[104.0, 104.0, 99.0, 299.0]
[312, 266, 266, 354]
p02727
u202560873
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['from collections import deque\n\nX, Y, A, B, C = [int(x) for x in input().split()]\np = deque(sorted([int(x) for x in input().split()]))\nq = deque(sorted([int(x) for x in input().split()]))\nr = deque(sorted([int(x) for x in input().split()]))\n\nans = 0\nfor i in range(X):\n if p[0] >= r[0]:\n ans += p.popleft()\n else:\n ans += r.popleft()\n\nfor i in range(Y):\n if q[0] >= r[0]:\n ans += q.popleft()\n else:\n ans += r.popleft()\n\nprint(ans)', 'X, Y, A, B, C = [int(x) for x in input().split()]\np = sorted([int(x) for x in input().split()], reverse=True)[:X]\nq = sorted([int(x) for x in input().split()], reverse=True)[:Y]\nr = sorted([int(x) for x in input().split()], reverse=True)[:X + Y]\n\ns = sorted(p + q + r, reverse=True)\n\nans = sum(s[:X + Y])\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s039492144', 's134031393']
[29652.0, 28372.0]
[189.0, 164.0]
[469, 316]
p02727
u218757284
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\n\nra = list(map(int, input().split()))\ngb = list(map(int, input().split()))\nsc = list(map(int, input().split()))\n\nra.sort(reverse=True)\ngb.sort(reverse=True)\nsc.sort(reverse=True)\n\ncurr_red_min_val = ra[x-1]\ncurr_green_min_val = gb[y-1]\ntmp_x = x\ntmp_y = y\n\nfor i in range(c):\n if tmp_x > 0 and curr_red_min_val < curr_green_min_val:\n if sc[i] > curr_red_min_val:\n ra[tmp_x-1] = sc[i]\n tmp_x -= 1\n if tmp_x != 0:\n curr_red_min_val = ra[tmp_x-1]\n else:\n curr_red_min_val = ra[0]\n else tmp_y > 0:\n if sc[i] > curr_green_min_val:\n gb[tmp_y-1] = sc[i]\n tmp_y -= 1\n if tmp_y != 0:\n curr_green_min_val = gb[tmp_y-1]\n else:\n curr_green_min_val = gb[0]\n \nprint(sum(ra[:x])+sum(gb[:y]))', 'x, y, a, b, c = map(int, input().split())\n\nra = list(map(int, input().split()))\ngb = list(map(int, input().split()))\nsc = list(map(int, input().split()))\n\nra.sort(reverse=True)\ngb.sort(reverse=True)\nsc.sort(reverse=True)\n\ncurr_red_min_val = ra[x-1]\ncurr_green_min_val = gb[y-1]\ntmp_x = x\ntmp_y = y\n\nfor i in range(c):\n if tmp_x > 0 and curr_red_min_val < curr_green_min_val:\n if sc[i] > curr_red_min_val:\n ra[tmp_x-1] = sc[i]\n tmp_x -= 1\n if tmp_x != 0:\n curr_red_min_val = ra[tmp_x-1]\n else:\n curr_red_min_val = ra[0]\n elif tmp_y > 0:\n if sc[i] > curr_green_min_val:\n gb[tmp_y-1] = sc[i]\n tmp_y -= 1\n if tmp_y != 0:\n curr_green_min_val = gb[tmp_y-1]\n else:\n curr_green_min_val = gb[0]\n \nprint(sum(ra[:x])+sum(gb[:y]))']
['Runtime Error', 'Accepted']
['s242580885', 's807257111']
[3064.0, 23328.0]
[17.0, 277.0]
[799, 799]
p02727
u223646582
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C = map(int, input().split())\nP = sorted([int(i) for i in input().split()], reverse=True)\nQ = sorted([int(i) for i in input().split()], reverse=True)\nR = sorted([int(i) for i in input().split()])\n\n\nS = sorted(P[:X]+Q[:Y]+R, reverse=True)\nans = sum(S[:X+Y])\n', 'X, Y, A, B, C = map(int, input().split())\nP = sorted([int(i) for i in input().split()], reverse=True)\nQ = sorted([int(i) for i in input().split()], reverse=True)\nR = sorted([int(i) for i in input().split()])\n\nS = sorted(P[:X]+Q[:Y]+R, reverse=True)\n\nprint(sum(S[:X+Y]))\n']
['Wrong Answer', 'Accepted']
['s797719666', 's720150297']
[22720.0, 23200.0]
[262.0, 254.0]
[269, 270]
p02727
u231229291
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\nlist_of_red = list(map(int, input().split()))\nlist_of_green = list(map(int, input().split()))\nlist_of_colorless = list(map(int, input().split()))\n\nlist_of_green.sort(reverse=True)\nlist_of_red.sort(reverse=True)\nlist_of_colorless.sort(reverse=True)\n\nmax_of_red = list_of_red[0:x]\nmax_of_green = list_of_green[0:y]\n\nans = sum((max_of_red+max_of_green+list_of_colorless)[:x+y])\nprint(ans)', 'x, y, a, b, c = map(int, input().split())\nlist_of_red = list(map(int, input().split()))\nlist_of_green = list(map(int, input().split()))\nlist_of_colorless = list(map(int, input().split()))\n\nlist_of_green.sort(reverse=True)\nlist_of_red.sort(reverse=True)\nlist_of_colorless.sort(reverse=True)\n\nmax_of_red = list_of_red[:x]\nmax_of_green = list_of_green[:y]\n\ntemp = (max_of_red+max_of_green+list_of_colorless)\ntemp.sort(reverse=True)\nans = sum(temp[:x+y])\nprint(ans)']
['Wrong Answer', 'Accepted']
['s165971067', 's403007842']
[23328.0, 23328.0]
[211.0, 264.0]
[427, 461]
p02727
u239342230
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C = map(int,input().split())\nP = sorted(list(map(int,input().split())), reverse=True)\nQ = sorted(list(map(int,input().split())), reverse=True)\nR = sorted(list(map(int,input().split())), reverse=True)\nP = P[:X]\nQ = Q[:Y]\nA = P + Q + R\nA.sorted(reverse=True)\nans = sum(A[:X+Y])\nprint(ans)', 'X, Y, A, B, C = map(int,input().split())\nP = sorted(list(map(int,input().split())), reverse=True)\nQ = sorted(list(map(int,input().split())), reverse=True)\nR = sorted(list(map(int,input().split())), reverse=True)\nP = P[:X]\nQ = Q[:Y]\nA = P + Q + R\nA.sort(reverse=True)\nans = sum(A[:X+Y])\nprint(ans)']
['Runtime Error', 'Accepted']
['s796982665', 's007155719']
[23200.0, 23200.0]
[205.0, 249.0]
[298, 296]
p02727
u243714267
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\np.sort()\nq.sort()\nr.sort()\n', 'x, y, a, b, c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\np.sort()\np = p[len(p)-x:]\nq.sort()\nq = q[len(q)-y:]\nr.extend(q)\nr.extend(p)\nr.sort()\n\nprint(sum(r[len(r)-(x+y):]))']
['Wrong Answer', 'Accepted']
['s367413264', 's143438977']
[23456.0, 23540.0]
[195.0, 229.0]
[177, 264]
p02727
u248670337
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c=map(int,input().split())\nP=sorted(list(map(int,input().split())))[::-1]\nQ=sorted(list(map(int,input().split())))[::-1]\nR=sorted(list(map(int,input().split())))[::-1]+[0]*(max(x+y-c,0))\nL=sorted(P[:x]+Q[:y])[::-1]\nprint(L)\nprint(R)\nl=r=0\nfor i in range(x+y): \n if r+R[i]<l+L[-i-1]:\n print(sum(L[:x+y-i]+sorted(L[x+y-i:]+R[:i])[::-1][:i]))\n exit()\n r+=R[i]\n l+=L[-i-1]\nprint(r)', 'x,y,a,b,c=map(int,input().split())\nP=sorted(list(map(int,input().split())))[::-1]\nQ=sorted(list(map(int,input().split())))[::-1]\nR=list(map(int,input().split()))\nL=sorted(P[:x]+Q[:y]+R)[::-1]\nprint(sum(L[:x+y]))']
['Wrong Answer', 'Accepted']
['s585541270', 's532803705']
[27904.0, 23392.0]
[508.0, 319.0]
[408, 211]
p02727
u249218427
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['# -*- coding: utf-8 -*-\n\nfrom collections import deque\n\nX,Y,A,B,C = map(int, input().split())\nP = list(map(int, input().split()))\nQ = list(map(int, input().split()))\nR = list(map(int, input().split()))\n\ndef sort(L):\n if len(L)==1:\n return L\n left = sort(L[:len(L)//2])\n right = sort(L[len(L)//2:])\n result = []\n left.append(-1)\n right.append(-1)\n left_index = 0\n right_index = 0\n while len(result)<len(L):\n if left[left_index]>=right[right_index]:\n result.append(left[left_index])\n left_index += 1\n else:\n result.append(right[right_index])\n right_index += 1\n return result\n\nP = sort(P)[:X]\nQ = sort(Q)[:Y]\nR = sort(R)\n\nP_index = X-1\nQ_index = Y-1\nR_index = 0', '# -*- coding: utf-8 -*-\n\nfrom collections import deque\n\nX,Y,A,B,C = map(int, input().split())\nP = list(map(int, input().split()))\nQ = list(map(int, input().split()))\nR = list(map(int, input().split()))\n\nP = sorted(P, reverse=True)[:X]\nQ = sorted(Q, reverse=True)[:Y]\nR = sorted(P+Q+R, reverse=True)[:X+Y]\n\nprint(sum(R)', '# -*- coding: utf-8 -*-\nX,Y,A,B,C = map(int, input().split())\nP = sorted(map(int, input().split()), reverse=True)[:X]\nQ = sorted(map(int, input().split()), reverse=True)[:Y]\nR = sorted(P+Q+list(map(int, input().split())), reverse=True)[:X+Y]\nprint(sum(R))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s043131583', 's530094893', 's460745332']
[23616.0, 3064.0, 23956.0]
[1903.0, 18.0, 257.0]
[697, 318, 255]
p02727
u257162238
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['from pprint import pprint\nfrom bisect import bisect_left\nimport numpy\n\n\ndef read():\n X, Y, A, B, C = list(map(int, input().strip().split()))\n P = list(map(int, input().strip().split()))\n Q = list(map(int, input().strip().split()))\n R = list(map(int, input().strip().split()))\n return X, Y, A, B, C, P, Q, R\n\ndef argsort(x, reverse=False):\n return sorted(range(len(x)), key=lambda k: x[k], reverse=reverse)\n\ndef solve(X, Y, A, B, C, P, Q, R):\n P = list(sorted(P, reverse=True))\n Q = list(sorted(Q, reverse=True))\n R = list(sorted(R, reverse=True))\n\n i = X\n j = Y\n k = 0\n score = sum(P[0:i]) + sum(Q[0:j])\n for r in R:\n if i > 0 and j > 0:\n if P[i-1] < Q[j-1] and P[i-1] < r:\n score = score - P[i-1] + r\n i -= 1\n k += 1\n elif Q[j-1] <= P[i-1] and Q[j-1] < r:\n score = score - Q[j-1] + r\n j -= 1\n k += 1\n else:\n break\n elif i > 0:\n if P[i-1] < r:\n score = score - P[i-1] + r\n i -= 1\n k += 1\n else:\n break\n elif j > 0:\n if Q[j-1] < r:\n score = score - Q[j-1] + r\n j -= 1\n k += 1\n else:\n break\n else:\n break\n print(P[:i])\n print(Q[:j])\n print(R[:(X-i)], R[(X-i):(Y-j)])\n return sum(P[:i] + Q[:j] + R[:(X-i)+(Y-j)])\n\nif __name__ == \'__main__\':\n inputs = read()\n print("{}".format(solve(*inputs)))\n', 'from pprint import pprint\nfrom bisect import bisect_left\nimport numpy\n\n\ndef read():\n X, Y, A, B, C = list(map(int, input().strip().split()))\n P = list(map(int, input().strip().split()))\n Q = list(map(int, input().strip().split()))\n R = list(map(int, input().strip().split()))\n return X, Y, A, B, C, P, Q, R\n\ndef argsort(x, reverse=False):\n return sorted(range(len(x)), key=lambda k: x[k], reverse=reverse)\n\ndef solve(X, Y, A, B, C, P, Q, R):\n P = list(sorted(P, reverse=True))\n Q = list(sorted(Q, reverse=True))\n R = list(sorted(R, reverse=True))\n\n i = X\n j = Y\n score = sum(P[0:i]) + sum(Q[0:j])\n for r in R:\n if i > 0 and j > 0:\n if P[i-1] < Q[j-1] and P[i-1] < r:\n score = score - P[i-1] + r\n i -= 1\n elif P[i-1] <= Q[j-1] and Q[j-1] < r:\n score = score - Q[j-1] + r\n j -= 1\n else:\n break\n elif i > 0:\n if P[i-1] < r:\n score = score - P[i-1] + r\n i -= 1\n else:\n break\n elif j > 0:\n if Q[j-1] < r:\n score = score - Q[j-1] + r\n j -= 1\n else:\n break\n else:\n break\n return sum(P[:i] + Q[:j] + R[:(X-i)+(Y-j)])\n\nif __name__ == \'__main__\':\n inputs = read()\n print("{}".format(solve(*inputs)))\n', 'from pprint import pprint\nfrom bisect import bisect_left\nimport numpy\n\n\ndef read():\n X, Y, A, B, C = list(map(int, input().strip().split()))\n P = list(map(int, input().strip().split()))\n Q = list(map(int, input().strip().split()))\n R = list(map(int, input().strip().split()))\n return X, Y, A, B, C, P, Q, R\n\ndef argsort(x, reverse=False):\n return sorted(range(len(x)), key=lambda k: x[k], reverse=reverse)\n\ndef solve(X, Y, A, B, C, P, Q, R):\n P = list(sorted(P, reverse=True))\n Q = list(sorted(Q, reverse=True))\n R = list(sorted(R, reverse=True))\n\n i = X\n j = Y\n score = sum(P[0:i]) + sum(Q[0:j])\n for r in R:\n if i > 0 and j > 0:\n if P[i-1] < Q[j-1] and P[i-1] < r:\n score = score - P[i-1] + r\n i -= 1\n elif Q[j-1] <= P[i-1] and Q[j-1] < r:\n score = score - Q[j-1] + r\n j -= 1\n else:\n break\n elif i > 0:\n if P[i-1] < r:\n score = score - P[i-1] + r\n i -= 1\n else:\n break\n elif j > 0:\n if Q[j-1] < r:\n score = score - Q[j-1] + r\n j -= 1\n else:\n break\n else:\n break\n return sum(P[:i] + Q[:j] + R[:(X-i)+(Y-j)])\n\nif __name__ == \'__main__\':\n inputs = read()\n print("{}".format(solve(*inputs)))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s138727021', 's742717700', 's135397510']
[33828.0, 31484.0, 31484.0]
[433.0, 373.0, 390.0]
[1592, 1419, 1419]
p02727
u271934630
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import sys\nstdin = sys.stdin\nsys.setrecursionlimit(10 ** 7)\n\ni_i = lambda: int(i_s())\ni_l = lambda: list(map(int, stdin.readline().split()))\ni_s = lambda: stdin.readline().rstrip()\n\nX, Y, A, B, C = i_l()\np = i_l()\nq = i_l()\nr = i_l()\n\np = sorted(p, reverse=True)\nq = sorted(q, reverse=True)\nr = sorted(r, reverse=True)\n\np_i = 0\nq_i = 0\nr_i = 0\n\nans1 = 0\nfor i in range(X):\n if r_i > C-1 or p[p_i] > r[r_i]:\n ans1 += p[p_i]\n p_i += 1\n else:\n ans1 += r[r_i]\n r_i += 1\n print(ans1)\nfor i in range(Y):\n if r_i > C-1 or q[q_i] > r[r_i]:\n ans1 += q[q_i]\n q_i += 1\n else:\n ans1 += r[r_i]\n r_i += 1\n\n\nans2 = 0\np_i = 0\nq_i = 0\nr_i = 0\nfor i in range(Y):\n if r_i > C-1 or q[q_i] > r[r_i]:\n ans2 += q[q_i]\n q_i += 1\n else:\n ans2 += r[r_i]\n r_i += 1\nfor i in range(X):\n if r_i > C-1 or p[p_i] > r[r_i]:\n ans2 += p[p_i]\n p_i += 1\n else:\n ans2 += r[r_i]\n r_i += 1\n\nans3 = 0\nif X + Y <= C:\n ans3 = sum(r[:(X+Y)])\n\nprint(max(ans1, ans2, ans3))', 'import sys\nstdin = sys.stdin\nsys.setrecursionlimit(10 ** 7)\n\ni_i = lambda: int(i_s())\ni_l = lambda: list(map(int, stdin.readline().split()))\ni_s = lambda: stdin.readline().rstrip()\n\nX, Y, A, B, C = i_l()\np = i_l()\nq = i_l()\nr = i_l()\n\np = sorted(p, reverse=True)\nq = sorted(q, reverse=True)\nr = sorted(r, reverse=True)\n\np = p[:X]\nq = q[:Y]\narr = sorted((p + q + r), reverse=True)\n\nprint(sum(arr[:(X+Y)]))']
['Wrong Answer', 'Accepted']
['s128327628', 's794840583']
[23200.0, 23212.0]
[441.0, 254.0]
[1069, 404]
p02727
u281796054
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c=map(int,input().split())\nred=sorted(list(map(int,input().split())),reverse=True)\ngreen=sorted(list(map(int,input().split())),reverse=True)\nwhite=sorted(list(map(int,input().split())),reverse=True)\neat_list=sorted(red[:x]+green[:y])\nfor i in range(min(len(eat_list),len(white))):\n if eat_list[i]<white[i]:\n eat_list[i]=white[i]\n else:\n break\nprint(eat_list)\nprint(sum(eat_list))', 'x,y,a,b,c=map(int,input().split())\nred=sorted(list(map(int,input().split())),reverse=True)\ngreen=sorted(list(map(int,input().split())),reverse=True)\nwhite=sorted(list(map(int,input().split())),reverse=True)\neat_list=sorted(red[:x]+green[:y])\nfor i in range(min(len(eat_list),len(white))):\n if eat_list[i]<white[i]:\n eat_list[i]=white[i]\n else:\n break\nprint(sum(eat_list))\n']
['Wrong Answer', 'Accepted']
['s244230258', 's616251765']
[24764.0, 23200.0]
[266.0, 246.0]
[395, 380]
p02727
u289036437
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['def merge(l):\n t = [-1]*len(l)\n if(len(l) == 2):\n if(l[0]<l[1]):\n t[1] = l[0]\n t[0] = l[1]\n else:\n t=l\n elif(len(l) > 2):\n x = merge(l[:len(l)//2])\n y = merge(l[len(l)//2:])\n p,q = 0,0\n for i in range(len(l)):\n if(p<len(x) and q<len(y)):\n if(x[p] > y[q]):\n t[i] = x[p]\n p += 1\n else:\n t[i] = y[q]\n q += 1\n elif(p == len(x)):\n t[i] = y[q]\n q += 1\n else:\n t[i] = x[p]\n p += 1\n else:\n t = l\n return t\nx,y,a,b,c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\na = [x,y,0]\nP = merge(p)\nQ = merge(q)\nR = merge(r)\nX = P[:x]\nY = Q[:y]\nfor i in range(x+y):\n if(a[2] == c):\n break\n elif(a[0] == 0):\n if(Y[a[1]-1] < R[a[2]]):\n a[1] -= 1\n a[2] += 1\n else:\n break\n elif(a[1] == 0):\n if(X[a[0]-1] < R[a[2]]):\n a[0] -= 1\n a[2] += 1\n else:\n break\n else:\n if(X[a[0]-1] > Y[a[1]-1]):\n if(Y[a[1]-1] < R[a[2]]):\n a[1] -= 1\n a[2] += 1\n else:\n break\n else:\n if(X[a[0]-1] < R[a[2]]):\n a[0] -= 1\n a[2] += 1\n else:\n break\nm = 0\nfor i in range(a[0]):\n m += P[i]\nfor i in range(a[1]):\n m += Q[i]\nfor i in range(a[2]):\n m += R[i]\nprint(m)', 'def merge(l):\n t = [-1]*len(l)\n if(len(l) == 2):\n if(l[0]<l[1]):\n t[1] = l[0]\n t[0] = l[1]\n else:\n t=l\n elif(len(l) > 2):\n x = merge(l[:len(l)//2])\n y = merge(l[len(l)//2:])\n p,q = 0,0\n for i in range(len(l)):\n if(p<len(x) and q<len(y)):\n if(x[p] > y[q]):\n t[i] = x[p]\n p += 1\n else:\n t[i] = y[q]\n q += 1\n elif(p == len(x)):\n t[i] = y[q]\n q += 1\n else:\n t[i] = x[p]\n p += 1\n else:\n t = l\n return t\nx,y,a,b,c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\na = [x,y,0]\nP = merge(p)\nQ = merge(q)\nR = merge(r)\nX = P[:x]\nY = Q[:y]\nfor i in range(x+y):\n if(a[2] == c):\n break\n elif(a[0] == 0):\n if(Y[a[1]-1] < R[a[2]]):\n a[1] -= 1\n a[2] += 1\n else:\n break\n elif(a[1] == 0):\n if(X[a[0]-1] < R[a[2]]):\n a[0] -= 1\n a[2] += 1\n else:\n break\n else:\n if(X[a[0]-1] > Y[a[1]-1]):\n if(Y[a[1]-1] < R[a[2]]):\n a[1] -= 1\n a[2] += 1\n else:\n break\n else:\n if(X[a[0]-1] < R[a[2]]):\n a[0] -= 1\n a[2] += 1\n else:\n break\nm = 0\nfor i in range(a[0]):\n m += P[i]\nfor i in range(a[1]):\n m += Q[i]\nfor i in range(a[2]):\n m += R[i]\nprint(m)']
['Runtime Error', 'Accepted']
['s533641036', 's858783371']
[3064.0, 22716.0]
[17.0, 2000.0]
[1696, 1680]
p02727
u290886932
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np = p.sort(reverse=True)\nq = q.sort(reverse=True)\nr = r.sort(reverse=True)\np = p[:X]\nq = q[:Y]\nsumlist = list()\nsumlist.extend(p)\nsumlist.extend(q)\nsumlist.extend(r)\nsumlist = sumlist.sort(reverse=True)\nprint(sum(sumlist[:X+Y]))', 'X, Y, A, B, C = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\np = p[:X]\nq = q[:Y]\nsumlist = list()\nsumlist.extend(p)\nsumlist.extend(q)\nsumlist.extend(r)\nsumlist.sort(reverse=True)\nprint(sum(sumlist[:X+Y]))']
['Runtime Error', 'Accepted']
['s466330096', 's581788330']
[23328.0, 23328.0]
[200.0, 233.0]
[379, 357]
p02727
u307028468
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C = (int(x) for x in input().split())\nR = [int(i) for i in input().split()]\nG = [int(i) for i in input().split()]\nM = [int(i) for i in input().split()]\n\nprint(R, G, M)\n\nR.sort(reverse=True)\nG.sort(reverse=True)\n\nfor i in range(X):\n M.append(R[i])\n\nfor i in range(Y):\n M.append(G[i])\n\nM.sort(reverse=True)\n\nans = 0\nfor i in range(X + Y):\n ans = M[i] + ans\n\nprint(ans)\n', 'X, Y, A, B, C = (int(x) for x in input().split())\nR = [int(i) for i in input().split()]\nG = [int(i) for i in input().split()]\nM = [int(i) for i in input().split()]\n\nR.sort(reverse=True)\nG.sort(reverse=True)\n\nfor i in range(X):\n M.append(R[i])\n\nfor i in range(Y):\n M.append(G[i])\n\nM.sort(reverse=True)\n\nans = 0\nfor i in range(X + Y):\n ans = M[i] + ans\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s520069102', 's116241915']
[23340.0, 23340.0]
[428.0, 306.0]
[382, 366]
p02727
u308289897
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import sys\n\nstdin = sys.stdin\n\nns = lambda: stdin.readline().rstrip()\nni = lambda: int(stdin.readline().rstrip())\nnm = lambda: map(int, stdin.readline().split())\nnl = lambda: list(map(int, stdin.readline().split()))\nprint(nl)\nx, y, a, b, c = nm()\np = nl()\nq = nl()\nr = nl()\np.sort()\nq.sort()\nprint(p)\nprint(q)\nl = p[-x:] + q[-y:]\nl.sort()\nr.sort()\nfor i in range(c):\n if l[i] < r[-1]:\n l[i] = r.pop()\n else:\n break\nprint(sum(l))\n', 'import sys\n\nstdin = sys.stdin\n\nns = lambda: stdin.readline().rstrip()\nni = lambda: int(stdin.readline().rstrip())\nnm = lambda: map(int, stdin.readline().split())\nnl = lambda: list(map(int, stdin.readline().split()))\nx, y, a, b, c = nm()\np = nl()\nq = nl()\nr = nl()\np.sort()\nq.sort()\nl = p[-x:] + q[-y:]\nl.sort()\nr.sort()\nfor i in range(c):\n if l[i] < r[-1]:\n l[i] = r.pop()\n else:\n break\nprint(sum(l))\n']
['Wrong Answer', 'Accepted']
['s085173041', 's759173568']
[23472.0, 23212.0]
[276.0, 245.0]
[449, 421]
p02727
u309141201
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\np = sorted(map(int, input().split()))\nq = sorted(map(int, input().split()))\nr = sorted(map(int, input().split()))\nans = 0\nfor i in range(a):\n if len(p) > 0 and len(r) > 0:\n if p[-1] >= r[-1]:\n ans += p[-1]\n p.pop()\n else:\n ans += r[-1]\n r.pop()\n else:\n if len(p) == 0:\n ans += r[-1]\n else:\n ans += p[-1]\n \nfor i in range(b):\n if len(q) > 0 and len(r) > 0:\n if q[-1] >= r[-1]:\n ans += q[-1]\n q.pop()\n else:\n ans += r[-1]\n r.pop()\n else:\n if len(q) == 0:\n ans += r[-1]\n else:\n ans += q[-1]\n\nprint(ans)\n', 'x, y, a, b, c = map(int, input().split())\np = sorted(map(int, input().split()))\nq = sorted(map(int, input().split()))\nr = sorted(map(int, input().split()))\nans = p[-x:] + q[-y:] + r\nans.sort()\nn = len(ans)\ncnt = 0\nfor i in range(x+y):\n cnt += ans[n-1-i]\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s540357874', 's673087346']
[29732.0, 29236.0]
[225.0, 182.0]
[753, 267]
p02727
u316464887
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import sys\nsys.setrecursionlimit(100000)\nclass fact():\n def __init__(self, i, mod):\n self.l = [1] * (i+1)\n for i in range(1, i+1):\n self.l[i] = self.l[i-1] * i\n self.mod = mod\n self.g1 = [1, 1]\n self.g2 = [1, 1]\n inverse = [0, 1]\n for i in range(2, 2 * (10 ** 5) + 1):\n self.g1.append((self.g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod // i)) % mod)\n self.g2.append((self.g2[-1] * inverse[-1]) % mod)\n\n\ndef main():\n N = int(input())\n d = {}\n mod = 10**9 + 7\n f = fact(N, mod)\n for i in range(N-1):\n a, b = map(int, input().split())\n if a in d:\n d[a].append(b)\n else:\n d[a] = [b]\n if b in d:\n d[b].append(a)\n else:\n d[b] = [a]\n for i in range(1, N+1):\n v = set()\n r, t = solve(i, N, v, f, d)\n print(r % mod)\ndef solve(n, a, v, f, d):\n v.add(n)\n x = 0\n unv = []\n for i in d[n]:\n if i not in v:\n x += 1\n unv.append(i)\n if x == 1:\n r, t = solve(unv[0], a-1, v, f, d)\n return r, t + 1\n if x == 0:\n return 1, 1\n t = 1\n r = 1\n for i in unv:\n rr, tt = solve(i, a-1, v, f, d)\n t += tt\n r *= rr\n r *= f.g2[tt]\n r *= f.l[t-1]\n return r, t\nmain()\n', "import heapq\ndef main():\n X, Y, A, B, C = map(int, input().split())\n p = list(map(int, input().split()))\n q = list(map(int, input().split()))\n r = list(map(int, input().split()))\n p.sort(reverse=True)\n q.sort(reverse=True)\n r.sort(reverse=True)\n h = []\n for i in p[:X]:\n heapq.heappush(h, (i, 'r'))\n for i in q[:Y]:\n heapq.heappush(h, (i, 'g'))\n a = sum(p[:X]) + sum(q[:Y])\n ra = 0\n ga = 0\n i = 0\n while h:\n t = heapq.heappop(h)\n if r[i] < t[0]:\n break\n if t[1] == 'r' and ra <= X:\n a += r[i]\n a -= t[0]\n ra += 1\n i += 1\n elif t[1] == 'g' and ga <= Y:\n ga += 1\n a += r[i]\n a -= t[0]\n i += 1\n if ra == X and ga == Y:\n break\n if i >= C:\n break\n return a\nprint(main())\n"]
['Runtime Error', 'Accepted']
['s542994390', 's179203338']
[3188.0, 29856.0]
[19.0, 461.0]
[1376, 891]
p02727
u341267151
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c=map(int,input().split())\np=[0]+sorted(list(map(int,input().split())))[a-x:]\nq=[0]+sorted(list(map(int,input().split())))[b-y:]\nr=[0]+sorted(list(map(int,input().split())))\npi=-1\nqi=-1\nri=-1\ngs=0\nrs=0\nws=0\ns=0 \nwhile gs+rs+ws!=x+y:\n print(r[ri],p[pi],q[qi])\n if r[ri]>=q[qi]>=p[pi]:\n s += r[ri]\n ws+=1\n ri-=1\n\n elif r[ri]>=p[pi]>=q[qi]:\n s += r[ri]\n ws += 1\n ri -= 1\n\n elif q[qi]>=r[ri]>=p[pi]:\n s += q[qi]\n gs += 1\n qi -= 1\n\n elif q[qi]>=p[pi]>=r[ri]:\n s += q[qi]\n gs += 1\n qi -= 1\n\n elif p[pi]>=r[ri]>=q[qi]:\n s += p[pi]\n rs += 1\n pi -= 1\n\n elif p[pi]>=q[qi]>=r[ri]:\n s += p[pi]\n rs += 1\n pi -= 1\n\nprint(s)\n', 'x,y,a,b,c=map(int,input().split())\np=[0]+sorted(list(map(int,input().split())))[a-x:]\nq=[0]+sorted(list(map(int,input().split())))[b-y:]\nr=[0]+sorted(list(map(int,input().split())))\npi=-1\nqi=-1\nri=-1\ngs=0\nrs=0\nws=0\ns=0 \nwhile gs+rs+ws!=x+y:\n if r[ri]>=q[qi]>=p[pi]:\n s += r[ri]\n ws+=1\n ri-=1\n\n elif r[ri]>=p[pi]>=q[qi]:\n s += r[ri]\n ws += 1\n ri -= 1\n\n elif q[qi]>=r[ri]>=p[pi]:\n s += q[qi]\n gs += 1\n qi -= 1\n\n elif q[qi]>=p[pi]>=r[ri]:\n s += q[qi]\n gs += 1\n qi -= 1\n\n elif p[pi]>=r[ri]>=q[qi]:\n s += p[pi]\n rs += 1\n pi -= 1\n\n elif p[pi]>=q[qi]>=r[ri]:\n s += p[pi]\n rs += 1\n pi -= 1\n\nprint(s)\n']
['Wrong Answer', 'Accepted']
['s966445382', 's713599002']
[28200.0, 28372.0]
[648.0, 344.0]
[778, 749]
p02727
u347203174
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import numpy as np\n#inp = input\nfin = open("case_21.txt")\ninp = fin.readline\n\nX, Y, A, B, C = map(int, inp().split())\n\nred = np.array(list(map(int, inp().split())), np.int32)\ngreen = np.array(list(map(int, inp().split())), np.int32)\nwhite = np.array(list(map(int, inp().split())), np.int32)\nfin.close()\n\nred[::-1].sort()\ngreen[::-1].sort()\nwhite[::-1].sort()\nidr = 0\nidg = 0\nidw = 0\n\ntotal = 0.0\ncountr = 0\ncountg = 0\nwhile X > countr and Y > countg:\n if red[idr] > green[idg]:\n #compare green 1st\n if idw < C and green[idg] < white[idw]:\n #eat white\n total += white[idw]\n idw += 1\n else:\n #eat green\n total += green[idg]\n idg += 1\n countg += 1\n\n else:\n #compare red 1st\n if idw < C and red[idr] < white[idw]:\n #eat white\n total += white[idw]\n idw += 1\n else:\n #eat red\n total += red[idr]\n idr += 1\n\n countr += 1\n\n#eat remain\nwhile X > countr:\n # compare red 1st\n if idw < C and red[idr] < white[idw]:\n # eat white\n total += white[idw]\n idw += 1\n else:\n # eat red\n total += red[idr]\n idr += 1\n countr += 1\n\nwhile Y > countg:\n # compare green 1st\n if idw < C and green[idg] < white[idw]:\n # eat white\n total += white[idw]\n idw += 1\n else:\n # eat green\n total += green[idg]\n idg += 1\n countg += 1\n\nprint(int(total))\n', 'import numpy as np\n#inp = input\nfin = open("case_21.txt")\ninp = fin.readline\n\nX, Y, A, B, C = map(int, inp().split())\n\n#red = np.array(list(map(int, inp().split())), np.int32)\n#green = np.array(list(map(int, inp().split())), np.int32)\n#white = np.array(list(map(int, inp().split())), np.int32)\nred = list(map(int, inp().split()))\ngreen = list(map(int, inp().split()))\nwhite = list(map(int, inp().split()))\nred.sort(reverse=True)\ngreen.sort(reverse=True)\nwhite.sort(reverse=True)\nfin.close()\n\n#red[::-1].sort()\n#green[::-1].sort()\n#white[::-1].sort()\n\nidr = 0\nidg = 0\nidw = 0\n\ntotal = 0.0\ncountr = 0\ncountg = 0\n\nwhile X > countr and Y > countg:\n if red[idr] >= green[idg] and red[idr] >= white[idw]:\n #eat red\n total += red[idr]\n idr += 1\n countr += 1\n elif green[idg] > red[idr] and green[idg] >= white[idw]:\n # eat green\n total += green[idg]\n idg += 1\n countg += 1\n else:\n if red[idr] >= green[idg]:\n #compare green 1st\n if idw < C and green[idg] < white[idw]:\n #eat white\n total += white[idw]\n idw += 1\n else:\n #eat green\n total += green[idg]\n idg += 1\n countg += 1\n\n else:\n #compare red 1st\n if idw < C and red[idr] < white[idw]:\n #eat white\n total += white[idw]\n idw += 1\n else:\n #eat red\n total += red[idr]\n idr += 1\n\n countr += 1\n\n#eat remain\nwhile X > countr:\n # compare red 1st\n if idw < C and red[idr] < white[idw]:\n # eat white\n total += white[idw]\n idw += 1\n else:\n # eat red\n total += red[idr]\n idr += 1\n countr += 1\n\nwhile Y > countg:\n # compare green 1st\n if idw < C and green[idg] < white[idw]:\n # eat white\n total += white[idw]\n idw += 1\n else:\n # eat green\n total += green[idg]\n idg += 1\n countg += 1\n\nprint(int(total))\n', 'import numpy as np\n#inp = input\nfin = open("case_21.txt")\ninp = fin.readline\n\nX, Y, A, B, C = map(int, inp().split())\n\n#red = np.array(list(map(int, inp().split())), np.int32)\n#green = np.array(list(map(int, inp().split())), np.int32)\n#white = np.array(list(map(int, inp().split())), np.int32)\nred = list(map(int, inp().split()))\ngreen = list(map(int, inp().split()))\nwhite = list(map(int, inp().split()))\nred.sort(reverse=True)\ngreen.sort(reverse=True)\nwhite.sort(reverse=True)\nfin.close()\n\n#red[::-1].sort()\n#green[::-1].sort()\n#white[::-1].sort()\n\nidr = 0\nidg = 0\nidw = 0\n\ntotal = 0.0\ncountr = 0\ncountg = 0\ncountw = 0\nwhile X > countr and Y > countg and (X+Y > countr+countg+countw):\n if red[idr] >= green[idg]:\n if idw >= C or red[idr] >= white[idw]:\n #eat red\n total += red[idr]\n idr += 1\n countr += 1\n elif idw < C:\n #eat white\n total += white[idw]\n idw += 1\n countw += 1\n else:\n if idw >= C or green[idg] >= white[idw]:\n # eat green\n total += green[idg]\n idg += 1\n countg += 1\n else:\n #eat white\n total += white[idw]\n idw += 1\n countw += 1\n\n#eat remain\nif Y <= countg:\n while X > countr+countw:\n # compare red 1st\n if idw < C and red[idr] < white[idw]:\n # eat white\n total += white[idw]\n idw += 1\n else:\n # eat red\n total += red[idr]\n idr += 1\n countr += 1\n\nif X <= countr:\n while Y > countg+countw:\n # compare green 1st\n if idw < C and green[idg] < white[idw]:\n # eat white\n total += white[idw]\n idw += 1\n else:\n # eat green\n total += green[idg]\n idg += 1\n countg += 1\n\nprint(int(total))\n', 'import numpy as np\ninp = input\n#fin = open("case_21.txt")\n#inp = fin.readline\n\nX, Y, A, B, C = map(int, inp().split())\n\n#red = np.array(list(map(int, inp().split())), np.int32)\n#green = np.array(list(map(int, inp().split())), np.int32)\n#white = np.array(list(map(int, inp().split())), np.int32)\nred = list(map(int, inp().split()))\ngreen = list(map(int, inp().split()))\nwhite = list(map(int, inp().split()))\nred.sort(reverse=True)\ngreen.sort(reverse=True)\nwhite.sort(reverse=True)\n#fin.close()\n\n#red[::-1].sort()\n#green[::-1].sort()\n#white[::-1].sort()\n\nidr = 0\nidg = 0\nidw = 0\n\ntotal = 0.0\ncountr = 0\ncountg = 0\ncountw = 0\nwhile X > countr and Y > countg and (X+Y > countr+countg+countw):\n if red[idr] >= green[idg]:\n if idw >= C or red[idr] >= white[idw]:\n #eat red\n total += red[idr]\n idr += 1\n countr += 1\n elif idw < C:\n #eat white\n total += white[idw]\n idw += 1\n countw += 1\n else:\n if idw >= C or green[idg] >= white[idw]:\n # eat green\n total += green[idg]\n idg += 1\n countg += 1\n else:\n #eat white\n total += white[idw]\n idw += 1\n countw += 1\n\n#eat remain\nif Y <= countg:\n while X > countr+countw:\n # compare red 1st\n if idw < C and red[idr] < white[idw]:\n # eat white\n total += white[idw]\n idw += 1\n else:\n # eat red\n total += red[idr]\n idr += 1\n countr += 1\n\nif X <= countr:\n while Y > countg+countw:\n # compare green 1st\n if idw < C and green[idg] < white[idw]:\n # eat white\n total += white[idw]\n idw += 1\n else:\n # eat green\n total += green[idg]\n idg += 1\n countg += 1\n\nprint(int(total))\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s658264485', 's660133629', 's945280991', 's062755277']
[27076.0, 27132.0, 27004.0, 47172.0]
[114.0, 112.0, 114.0, 333.0]
[1516, 2092, 1896, 1898]
p02727
u350412774
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['xyabc = list(map(int,input().rsplit()))\np = list(map(int,input().rsplit()))\nq = list(map(int,input().rsplit()))\nr = list(map(int,input().rsplit()))\nx = xyabc[0]\ny = xyabc[1]\np.sort()\nq.sort()\n\nz =p[:x]+q[:y]\nz = z + r\nz.sort()\nprint(sum(z[:x+y]))\n', 'xyabc = list(map(int,input().rsplit()))\np = list(map(int,input().rsplit()))\nq = list(map(int,input().rsplit()))\nr = list(map(int,input().rsplit()))\nx = xyabc[0]\ny = xyabc[1]\np.sort(reverse=True)\nq.sort(reverse=True)\n\nz =p[:x]+q[:y]\nz = z + r\nz.sort(reverse=True)\nprint(sum(z[:x+y]))\n']
['Wrong Answer', 'Accepted']
['s648865670', 's759154181']
[23996.0, 23216.0]
[238.0, 240.0]
[247, 283]
p02727
u370429695
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['from collections import deque\n\nx,y,a,b,c = map(int,input().split())\np = list(map(int,input().split()))\nq = list(map(int,input().split()))\nr = list(map(int,input().split()))\np.sort()\nq.sort()\nr.sort(reverse=True)\nxlis = deque(p[len(p)-x:])\nylis = deque(q[len(q)-y:])\nr = deque(r)\nwhile True:\n xs = xlis.popleft()\n ys = ylis.popleft()\n rm = r.popleft()\n if rm < xs and rm < ys:\n xlis.append(xs)\n ylis.append(ys)\n break\n if xs < ys and xs < rm:\n xlis.append(rm)\n ylis.append(ys)\n elif ys < xs and ys < rm:\n ylis.append(rm)\n xlis.append(xs) \nprint(sum(xlis)+sum(ylis))', 'X, Y, A, B, C = map(int, input().split())\nP = sorted(list(map(int, input().split())), reverse = True)\nQ = sorted(list(map(int, input().split())), reverse = True)\nR = list(map(int, input().split()))\n\na = sorted(P[:X] + Q[:Y] + R, reverse = True)\nprint(sum(a[:(X+Y)]))\n']
['Runtime Error', 'Accepted']
['s151143562', 's415341503']
[23616.0, 22460.0]
[256.0, 237.0]
[631, 268]
p02727
u370721525
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\nred = sorted(p, reverse=True)[:X]\ngreen = sorted(q, reverse=True)[:Y]\nwhite = sorted(r, reverse=True)\n\noriginal = sorted(red + green)\nwhile original[0] < white[0]:\n original[0] = white[0]\n white.pop(0)\n original.sort()\n \nprint(sum(original))\n', 'X, Y, A, B, C = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\nred = sorted(p, reverse=True)[:X-1]\ngreen = sorted(q, reverse=True)[:Y-1]\nwhite = sorted(r, reverse=True)\n\noriginal = sorted(red + green)\nwhile original[0] < white[0]:\n original[0] = white[0]\n white.pop(0)\n original.sort()\n \nprint(sum(original))', 'from collections import deque\nX, Y, A, B, C = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np.sort(reverse=True)\nq.sort(reverse=True)\nr = sorted(r, reverse=True)\n\nans_p = deque(p[:X])\nans_q = deque(q[:Y])\nans_r = deque(r)\n\nwhile (ans_p[-1]<ans_r[0]) or (ans_q[-1]<ans_r[0]):\n if ans_p[-1] <= ans_q[-1]:\n ans_p.pop()\n ans_p.appendleft(ans_r[0])\n ans_r.popleft()\n else:\n ans_q.pop()\n ans_q.appendleft(ans_r[0])\n ans_r.popleft()\n if not ans_r:\n break;\n \nans = sum(ans_p) + sum(ans_q)\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s002120369', 's629226615', 's426514672']
[22720.0, 23328.0, 29548.0]
[2105.0, 2108.0, 180.0]
[397, 400, 607]
p02727
u373047809
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['(x, y, a, b, c), p, q, r = [map(int, o.split()) for o in open(0)]\nprint(sum(sorted(sorted(p)[-x:] + sorted(q)[-y:] + r)[-x-y:]))', '(x, y, a, b, c), p, q, r = [map(int, o.split()) for o in open(0)]\nprint(sum(sorted(sorted(p)[-x:] + sorted(q)[-y:] + list(r))[-x-y:]))']
['Runtime Error', 'Accepted']
['s186662580', 's213794166']
[35592.0, 35496.0]
[110.0, 156.0]
[128, 134]
p02727
u375941094
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['def main():\n X, Y, A, B, C = map(int, input().split())\n aka_list = sorted([int(t) for t in input().split()],reverse=True)[:X]\n midori_list = sorted([int(t) for t in input().split()],reverse=True)[:Y]\n mu_list = sorted([int(t) for t in input().split()],reverse=True)\n \n sum_list = sorted(aka_list + midori_list + mu_list ,reverse=True)[:X+Y]\n print(sum(sum_list))', 'def main():\n X, Y, A, B, C = map(int, input().split())\n aka_list = sorted([int(t) for t in input().split()],reverse=True)[:X]\n midori_list = sorted([int(t) for t in input().split()],reverse=True)[:Y]\n mu_list = sorted([int(t) for t in input().split()],reverse=True)\n \n j = 0\n sum_list = sorted(aka_list + midori_list)\n for i in range(len(sum_list)):\n if sum_list[i] < mu_list[j]:\n sum_list[i] = mu_list[j]\n j += 1\n print(sum(sum_list))\n \nmain()', 'スコード \n\nCopy\nCopy\ndef main():\n X, Y, A, B, C = map(int, input().split())\n aka_list = sorted([int(t) for t in input().split()],reverse=True)[:X]\n midori_list = sorted([int(t) for t in input().split()],reverse=True)[:Y]\n mu_list = sorted([int(t) for t in input().split()],reverse=True)\n \n sum_list = sorted(aka_list + midori_list + mu_list)[:X+Y]\n print(sum(sum_list))\n ', 'def main():\n X, Y, A, B, C = map(int, input().split())\n aka_list = sorted([int(t) for t in input().split()],reverse=True)[:X]\n midori_list = sorted([int(t) for t in input().split()],reverse=True)[:Y]\n mu_list = sorted([int(t) for t in input().split()],reverse=True)\n \n sum_list = sorted(aka_list + midori_list + mu_list ,reverse=True)[:X+Y]\n print(sum(sum_list))\n\nmain()']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s032023044', 's205048161', 's708592157', 's616897877']
[3064.0, 22544.0, 3064.0, 22544.0]
[17.0, 254.0, 17.0, 245.0]
[370, 468, 384, 378]
p02727
u377989038
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['from collections import deque\n\nx, y, a, b, c = map(int, input().split())\nR = sorted(list(map(int, input().split())))[a - x:]\nG = sorted(list(map(int, input().split())))[b - y:]\nM = deque(sorted(list(map(int, input().split())), reverse=True))\n\nans = sum(R) + sum(G)\nr, g, m = 0, 0, 0\nfor i in range(x + y):\n if not M:\n break\n if r >= x:\n if G[g] < M[m]:\n ans = ans - G[g] + M[m]\n g += 1\n m += 1\n elif g >= y:\n if R[r] < M[m]:\n ans = ans - R[r] + M[m]\n r += 1\n m += 1\n else:\n if\n\nx, y, a, b, c = map(int, input().split())\nR = sorted(list(map(int, input().split())), reverse=True)\nG = sorted(list(map(int, input().split())), reverse=True)\nM = sorted(list(map(int, input().split())), reverse=True)\n\nans, r, g, m = 0, 0, 0, 0\nmr = R[x - 1]\nmg = G[y - 1]\n\nfor i in range(x + y):\n if r >= x:\n if m >= c:\n ans += G[g]\n g += 1\n elif G[g] > M[m]:\n ans += G[g]\n g += 1\n else:\n ans += M[m]\n m += 1\n elif g >= y:\n if m >= c:\n ans += R[r]\n r += 1\n elif R[r] > M[m]:\n ans += R[r]\n r += 1\n else:\n ans += M[m]\n m += 1\n elif R[r] >= G[g]:\n if m >= c:\n ans += R[r]\n r += 1\n elif R[r] > M[m]:\n ans += R[r]\n r += 1\n else:\n ans += M[m]\n m += 1\n elif R[r] < G[g] or r >= x:\n if m >= c:\n ans += G[g]\n g += 1\n if G[g] > M[m]:\n ans += G[g]\n g += 1\n else:\n ans += M[m]\n m += 1\nprint(ans)\n', 'x, y, a, b, c = map(int, input().split())\nR = sorted(list(map(int, input().split())), reverse=True)\nG = sorted(list(map(int, input().split())), reverse=True)\nM = sorted(list(map(int, input().split())), reverse=True)\n\nans, r, g, m = 0, 0, 0, 0\nmr = R[x - 1]\nmg = G[y - 1]\n\nfor i in range(x + y):\n print(r, g, m)\n if r >= x:\n if G[g] > M[m] or m >= c:\n ans += G[g]\n g += 1\n else:\n ans += M[m]\n m += 1\n elif g >= y:\n if R[r] > M[m] or m >= c:\n ans += R[r]\n r += 1\n else:\n ans += M[m]\n m += 1\n elif R[r] >= G[g]:\n if R[r] > M[m] or m >= c:\n ans += R[r]\n r += 1\n else:\n ans += M[m]\n m += 1\n elif R[r] < G[g] or r >= x:\n if G[g] > M[m] or m >= c:\n ans += G[g]\n g += 1\n else:\n ans += M[m]\n m += 1\nprint(ans)', 'x, y, a, b, c = map(int, input().split())\nr = sorted(list(map(int, input().split())))[a - x:]\ng = sorted(list(map(int, input().split())))[b - y:]\nm = list(map(int, input().split()))\n\nans = sorted(r + g + m)\nprint(sum(ans[len(ans) - x - y:]))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s138603163', 's242389824', 's246325018']
[3064.0, 22720.0, 22488.0]
[17.0, 632.0, 242.0]
[1707, 947, 241]
p02727
u379720557
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C = map(int, input().split())\nr = list(map(int, input().split()))\ng = list(map(int, input().split()))\nnc = list(map(int, input().split()))\n\nr.sort(reverse=True)\ng.sort(reverse=True)\nnc.sort(reverse=True)\n\nselected = r[:X] + g[:Y]\nselected.sort()\n\nfor i in range(X+Y):\n if selected[i] < nc[i]:\n selected[i] = nc[i]\n \nprint(sum(selected))', 'X, Y, A, B, C = map(int, input().split())\nr = list(map(int, input().split()))\ng = list(map(int, input().split()))\nnc = list(map(int, input().split()))\n\nr.sort(reverse=True)\ng.sort(reverse=True)\nnc.sort(reverse=True)\n\nselected = r[:X] + g[:Y]\nselected.sort()\n\nif len(selected) > len(nc) or len(selected) == len(nc):\n L = len(nc)\nelse:\n L = len(selected)\n\nfor i in range(L):\n if selected[i] < nc[i]:\n selected[i] = nc[i]\n \nprint(sum(selected))']
['Runtime Error', 'Accepted']
['s343686051', 's104557443']
[22560.0, 23328.0]
[241.0, 265.0]
[355, 450]
p02727
u391066416
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C=map(int,input().split())\nP=sorted(list(map(int,input().split())))\nQ=sorted(list(map(int,input().split())))\nR=sorted(list(map(int,input().split())))\nP_=P[A-X:]\nQ_=Q[B-Y:]\nwhile P_[0]<R[-1] or Q_[0]<R[-1]:\n if P_[0]<Q_[0]:\n P_.pop(0)\n P_.append(R.pop(-1))\n else:\n Q_.pop(0)\n Q_.append(R.pop(-1))\nprint(sum(P_)+sum(Q_))', 'X,Y,A,B,C=map(int,input().split())\nP=sorted(list(map(int,input().split())))\nQ=sorted(list(map(int,input().split())))\nR=sorted(list(map(int,input().split())))\nS=sorted(P[A-X:]+Q[B-Y:])\nans=sum(S)\nfor i in range(min(R,S)):\n if S[i]<R[-1-i]:\n S[i]=R[-1-i]\n else:\n break\nprint(sum(S))', 'X,Y,A,B,C=map(int,input().split())\nP=sorted(list(map(int,input().split())))\nQ=sorted(list(map(int,input().split())))\nR=sorted(list(map(int,input().split())))\nS=sorted(P[A-X:]+Q[B-Y:])\ni=0\nwhile S[i]<R[-1-i]:\n if len(R)>i or len(S)>i:\n break\n i+=1\nprint(sum(S[i+1:])+R[-1-i:])', 'X,Y,A,B,C=map(int,input().split())\nP=sorted(list(map(int,input().split())))\nQ=sorted(list(map(int,input().split())))\nR=sorted(list(map(int,input().split())))\nS=sorted(P[A-X:]+Q[B-Y:])\ni=0\nwhile S[i]<R[-1-i]:\n if len(R)>i or len(S)>i:\n break\n i+=1\nif i==0:\n R=[]\nprint(sum(S[i:])+sum(R[-i:]))', 'X,Y,A,B,C=map(int,input().split())\nP=sorted(list(map(int,input().split())))\nQ=sorted(list(map(int,input().split())))\nR=sorted(list(map(int,input().split())))\nprint(sum(sorted(P[-X:]+Q[-Y:]+R)[-X-Y:]))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s291066827', 's704165943', 's950722520', 's964260452', 's106357598']
[23200.0, 23200.0, 22720.0, 22720.0, 23200.0]
[2104.0, 223.0, 236.0, 229.0, 246.0]
[360, 300, 288, 307, 200]
p02727
u395816772
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c = map(int, input().split())\n\ns_a = [int(i) for i in list(input().split())]\ns_b = [int(i) for i in list(input().split())]\ns_c = [int(i) for i in list(input().split())]\n\ns_a.sort(reverse = True)\ns_b.sort(reverse = True)\ns_c.sort(reverse = True)\n\nx_a = s_a[0:x]\nx_b = s_b[0:y]\n\n\nx_a.append(x_b)\nx_a.append(s_c)\nx_a.sort(reverse = True)\nans = x_a[0:x+y]\nprint(sum(ans))', 'x,y,a,b,c = map(int, input().split())\n\ns_a = [int(i) for i in list(input().split())]\ns_b = [int(i) for i in list(input().split())]\ns_c = [int(i) for i in list(input().split())]\n\ns_a.sort(reverse = True)\ns_b.sort(reverse = True)\ns_c.sort(reverse = True)\n\nx_a = s_a[0:x]\nx_b = s_b[0:y]\n\n\nsum_a = x_a + x_b + s_c\nsum_a.sort(reverse = True)\n\nprint(sum(sum_a))', "x,y,a,b,c = map(int, input().split())\n\ns_a = [int(i) for i in list(input().split())]\ns_b = [int(i) for i in list(input().split())]\ns_c = [int(i) for i in list(input().split())]\n\ns_a.sort(reverse = True)\ns_b.sort(reverse = True)\ns_c.sort(reverse = True)\n\nans = 0\nx_a = s_a[0:x]\nx_b = s_b[0:y]\n\nx_a.reverse()\nx_b.reverse()\n\ns = 0\nv = 0\nt = 0\nwhile s <= x and v <= y and t <= c:\n if x_a[s] <= x_b[v]:\n #print('B')\n if x_a[s] < s_c[t]:\n x_a[s] = s_c[t]\n s += 1\n t += 1\n else:\n break\n else:\n #print('A')\n if x_b[v] < s_c[t]:\n x_b[v] = s_c[t]\n v += 1\n t += 1\n else:\n break\n\nans = sum(x_a) + sum(x_b)\nprint(ans)", 'x,y,a,b,c = map(int, input().split())\n\ns_a = [int(i) for i in list(input().split())]\ns_b = [int(i) for i in list(input().split())]\ns_c = [int(i) for i in list(input().split())]\n\ns_a.sort(reverse = True)\ns_b.sort(reverse = True)\ns_c.sort(reverse = True)\n\nx_a = s_a[0:x]\nx_b = s_b[0:y]\n\n\nsum_a = x_a + x_b + s_c\nsum_a.sort(reverse = True)\nsum_a = sum_a[0:x+y]\nprint(sum(sum_a))']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s608484410', 's634908776', 's652430967', 's020220231']
[23296.0, 23296.0, 23296.0, 22592.0]
[218.0, 263.0, 277.0, 260.0]
[375, 355, 740, 375]
p02727
u402629484
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
["import sys\nsys.setrecursionlimit(1000000000)\nimport math\nfrom fractions import gcd\ndef lcm(a, b): return a * b // gcd(a, b)\nfrom itertools import count, permutations\nfrom functools import lru_cache\nfrom collections import deque, defaultdict\nfrom pprint import pprint\nii = lambda: int(input())\nmis = lambda: map(int, input().split())\nlmis = lambda: list(mis())\nINF = float('inf')\nN1097 = 10**9 + 7\n\ndef meg(f, ok, ng):\n while abs(ok-ng)>1:\n mid = (ok+ng)//2\n if f(mid):\n ok=mid\n else:\n ng=mid\n return ok\n\ndef get_inv(n, modp):\n return pow(n, modp-2, modp)\n\ndef factorials_list(n, modp): # 10**6\n fs = [1]\n for i in range(1, n+1):\n fs.append(fs[-1] * i % modp)\n return fs\n\ndef invs_list(n, fs, modp): # 10**6\n invs = [get_inv(fs[-1], modp)]\n for i in range(n, 1-1, -1):\n invs.append(invs[-1] * i % modp)\n invs.reverse()\n return invs\n\ndef comb(n, k, modp):\n num = 1\n for i in range(n, n-k, -1):\n num = num * i % modp\n den = 1\n for i in range(2, k+1):\n den = den * i % modp\n return num * get_inv(den, modp) % modp\n\ndef comb_from_list(n, k, modp, fs, invs): \n return fs[n] * invs[n-k] * invs[k] % modp\n\n#\n\nclass UnionFindEx:\n def __init__(self, size):\n \n self.roots = [-1] * size\n def getRootID(self, i):\n r = self.roots[i]\n if r < 0: \n return i\n else:\n r = self.getRootID(r)\n self.roots[i] = r\n return r\n def getGroupSize(self, i):\n return -self.roots[self.getRootID(i)]\n def connect(self, i, j):\n r1, r2 = self.getRootID(i), self.getRootID(j)\n if r1 == r2:\n return False\n if self.getGroupSize(r1) < self.getGroupSize(r2):\n r1, r2 = r2, r1\n self.roots[r1] += self.roots[r2] \n self.roots[r2] = r1\n return True\n\nYes = 'Yes'\nNo = 'No'\n\ndef main():\n X,Y,R,G,B=mis()\n rs=lmis()\n rs.sort(reverse=True)\n gs=lmis()\n gs.sort(reverse=True)\n bs=lmis()\n bs.sort(reverse=True)\n def get_score(red_paint):\n if red_paint > B:\n return INF\n if Y > G + (B - red_paint):\n return INF\n ans = 0\n ans += sum(bs[:red_paint])\n ans += sum(rs[:X - red_paint])\n gi = 0\n bi = red_paint\n for _ in range(Y):\n if G == gi:\n go_g = False\n elif B == bi:\n go_g = True\n else:\n go_g = (gs[gi] >= bs[bi])\n if go_g:\n ans += gs[gi]\n gi += 1\n else:\n ans += bs[bi]\n bi += 1\n return ans\n print(max(get_score(i) for i in range(X+1)))\n\n\nmain()\n\n\n\n\n\n", "import sys\nsys.setrecursionlimit(1000000000)\nimport math\nfrom fractions import gcd\ndef lcm(a, b): return a * b // gcd(a, b)\nfrom itertools import count, permutations, chain\nfrom functools import lru_cache\nfrom collections import deque, defaultdict\nfrom pprint import pprint\nii = lambda: int(input())\nmis = lambda: map(int, input().split())\nlmis = lambda: list(mis())\nINF = float('inf')\nN1097 = 10**9 + 7\n\ndef meg(f, ok, ng):\n while abs(ok-ng)>1:\n mid = (ok+ng)//2\n if f(mid):\n ok=mid\n else:\n ng=mid\n return ok\n\ndef get_inv(n, modp):\n return pow(n, modp-2, modp)\n\ndef factorials_list(n, modp): # 10**6\n fs = [1]\n for i in range(1, n+1):\n fs.append(fs[-1] * i % modp)\n return fs\n\ndef invs_list(n, fs, modp): # 10**6\n invs = [get_inv(fs[-1], modp)]\n for i in range(n, 1-1, -1):\n invs.append(invs[-1] * i % modp)\n invs.reverse()\n return invs\n\ndef comb(n, k, modp):\n num = 1\n for i in range(n, n-k, -1):\n num = num * i % modp\n den = 1\n for i in range(2, k+1):\n den = den * i % modp\n return num * get_inv(den, modp) % modp\n\ndef comb_from_list(n, k, modp, fs, invs): \n return fs[n] * invs[n-k] * invs[k] % modp\n\n#\n\nclass UnionFindEx:\n def __init__(self, size):\n \n self.roots = [-1] * size\n def getRootID(self, i):\n r = self.roots[i]\n if r < 0: \n return i\n else:\n r = self.getRootID(r)\n self.roots[i] = r\n return r\n def getGroupSize(self, i):\n return -self.roots[self.getRootID(i)]\n def connect(self, i, j):\n r1, r2 = self.getRootID(i), self.getRootID(j)\n if r1 == r2:\n return False\n if self.getGroupSize(r1) < self.getGroupSize(r2):\n r1, r2 = r2, r1\n self.roots[r1] += self.roots[r2] \n self.roots[r2] = r1\n return True\n\nYes = 'Yes'\nNo = 'No'\n\n\ndef main():\n X,Y,A,B,C=mis()\n p=lmis()\n q=lmis()\n r=lmis()\n p.sort(reverse=True)\n p = p[:A]\n q.sort(reverse=True)\n q = q[:B]\n print(sum(list(reversed(sorted(p+q+r)))[:X+Y]))\n\n\nmain()\n\n\n\n\n\n", 'mis = lambda: map(int, input().split())\nlmis = lambda: list(mis())\n\ndef main():\n X, Y, A, B, C = mis()\n p = sorted(lmis(), reverse=True)[:X]\n q = sorted(lmis(), reverse=True)[:Y]\n r = lmis()\n print(sum(sorted(p+q+r, reverse=True)[:X+Y]))\n\nmain()\n']
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s003886706', 's361405603', 's463121273']
[25408.0, 25440.0, 22504.0]
[2105.0, 259.0, 236.0]
[2849, 2231, 261]
p02727
u408071652
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['2 2 2 2 2\n8 6\n9 1\n2 1', '2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4', 'X,Y,A,B,C =map(int,input().split())\nP = list(map(int,input().split()))\nQ = list(map(int,input().split()))\nR = list(map(int,input().split()))\n\nP.sort()\nQ.sort()\nR.sort()\n\nP_new = P[-X::]\nQ_new = Q[-Y::]\n\n\nagg = P_new + Q_new +R\nagg.sort()\nprint(sum(agg[-X-Y::]))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s412516735', 's953559686', 's351820642']
[9012.0, 9000.0, 29540.0]
[26.0, 24.0, 165.0]
[21, 41, 261]
p02727
u408620326
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import sys\nimport numpy as np\nsys.setrecursionlimit(10 ** 6)\ninput = sys.stdin.readline\nX, Y, A, B, C = [int(x) for x in input().strip().split()]\np = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:X]\nq = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:Y]\nr = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:min(C, X+Y)]\n\nprint(p, q, r)\npi, qi, ri = X-1, Y-1, 0\ntp, tq, tr = p[pi], q[qi], r[ri]\nans = 0\nwhile pi >= 0 or qi >= 0:\n if tp >= tr and tq >= tr:\n break\n elif tp < tr and tq < tr:\n if tp < tq:\n p[pi] = r[ri]\n pi -= 1\n ri += 1\n else:\n q[qi] = r[ri]\n qi -= 1\n ri += 1\n elif tp < tr or tq < tr:\n if tp < tr:\n p[pi] = r[ri]\n ri += 1\n pi -= 1\n tp = p[pi]\n else:\n q[qi] = r[ri]\n ri += 1\n qi -= 1\n tq = q[qi]\n else:\n break\n\nprint(sum(p)+sum(q))', 'import sys\nimport numpy as np\nsys.setrecursionlimit(10 ** 6)\ninput = sys.stdin.readline\nX, Y, A, B, C = [int(x) for x in input().strip().split()]\np = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:X]\nq = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:Y]\nr = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:min(C, X+Y)]\n\npq = np.hstack((p, q))\npq.sort()\nri = 0\nfor i, t in enumerate(pq):\n if t < r[ri]:\n pq[i] = r[ri]\n ri += 1\nprint(sum(pq))', 'import sys\nimport numpy as np\nsys.setrecursionlimit(10 ** 6)\ninput = sys.stdin.readline\nX, Y, A, B, C = [int(x) for x in input().strip().split()]\np = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:X]\nq = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:Y]\nr = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:min(C, X+Y)]\n\npq = np.hstack((p, q, r))\npq.sort()\nprint(sum(pq[-(X+Y):]))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s497306288', 's655359818', 's061112564']
[24976.0, 26776.0, 24988.0]
[474.0, 501.0, 430.0]
[1037, 540, 462]
p02727
u413165887
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int,input().split())\n\np = list(map(int,input().split()))\nq = list(map(int,input().split()))\nr = list(map(int,input().split()))\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort()\np = p[:x]\nq = q[:y]\n\np.append(10**9+1)\nq.append(10**9+1)\nr.append(10**9+1)\nresult = sum(p+q)-2*(10**4)\nii, jj = x+y, c\nfor i in range(c):\n if p[x-1]<r[c-1]:\n result += r[c-1]-p[x-1]\n c -= 1\n x -= 1\n elif q[y-1]<r[c-1]:\n result += r[c-1]-q[y-1]\n c -= 1\n y -= 1\n else:\n break\n if c<0:\n break\nprint(result)', 'x, y, a, b, c = map(int,input().split())\n\np = list(map(int,input().split()))\nq = list(map(int,input().split()))\nr = list(map(int,input().split()))\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\nrr = [0]\nfor i in r:\n rr.append(rr[-1]+i)\np = p[:x]\nq = q[:y]\npq = sorted(p+q)\nppqq = [sum(pq)]\nfor i in pq:\n ppqq.append(ppqq[-1]-i)\nresult = []\nfor i in range(min(x+y, c+1)):\n result.append(ppqq[i]+rr[i])\nprint(max(result))']
['Wrong Answer', 'Accepted']
['s324847887', 's620073757']
[23328.0, 32524.0]
[266.0, 313.0]
[569, 444]
p02727
u414050834
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\nps=sorted(p,reverse=True)\nqs=sorted(q,reverse=True)\nrs=sorted(r,reverse=True)\npn=ps[:x]\nqn=qs[:y]\nmp=pn[-1]\nmq=qn[-1]\ns=0\nt=0\nfor i in range(max(x,y)):\n if mp>rs[i] and mq>rs[i]:\n break\n elif mp<=mq<=rs[i]:\n s+=1\n pn.pop(-s)\n pn.append(rs[i])\n if pn[-s-1]<rs[i]:\n mp=pn[-s-1]\n else:\n mp=rs[i]\n s=s-1\n elif mq<mp<=rs[i]:\n t+=1\n qn.pop(-t)\n qn.append(rs[i])\n if qn[-t-1]<rs[i]:\n mq=qn[-t-1]\n else:\n mq=rs[i]\n t=t-1\nprint(sum(pn)+sum(qn))', 'x,y,a,b,c=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\nps=sorted(p,reverse=True)\nqs=sorted(q,reverse=True)\npn=ps[:x]\nqn=qs[:y]\nnl=sorted(pn+qn+r,reverse=True)\nprint(sum(nl[:x+y]))\n']
['Runtime Error', 'Accepted']
['s128204867', 's066647113']
[23360.0, 24240.0]
[1005.0, 252.0]
[635, 259]
p02727
u432098488
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C = map(int, input().split())\nP = [-1] + sorted(list(map(int, input().split())))\nQ = [-1] + sorted(list(map(int, input().split())))\nR = [-1] + sorted(list(map(int, input().split())))\n\nans = 0\nN = X+Y\nwhile N > 0:\n max_V = max(P[-1], Q[-1], R[-1])\n if P[-1] == max_V:\n P.pop(-1)\n if X < 1:\n continue\n X -= 1\n elif Q[-1] == max_V:\n Q.pop(-1)\n if Y < 1:\n continue\n Y -= 1\n else:\n R.pop(-1)\n ans += max_V\n N = X+Y\n \nprint(ans)', 'X, Y, A, B, C = map(int, input().split())\nP = [-1] + sorted(list(map(int, input().split())))\nQ = [-1] + sorted(list(map(int, input().split())))\nR = [-1] + sorted(list(map(int, input().split())))\n\nans = 0\nr = 0\nN = X+Y\nwhile N > 0:\n max_V = max(P[-1], Q[-1], R[-1])\n if P[-1] == max_V:\n P.pop(-1)\n if X < 1:\n continue\n X -= 1\n elif Q[-1] == max_V:\n Q.pop(-1)\n if Y < 1:\n continue\n Y -= 1\n else:\n R.pop(-1)\n r += 1\n \n ans += max_V\n N = X+Y-r\n \nprint(ans)']
['Wrong Answer', 'Accepted']
['s911947337', 's278379738']
[23296.0, 23284.0]
[490.0, 408.0]
[472, 496]
p02727
u435480265
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c = map(int,input().split())\nlst_r = list(map(int,input().split()))\nlst_g = list(map(int,input().split()))\nlst_n = list(map(lambda x:int(x)*(-1),input().split()))\nfrom heapq import *\n\nheapify(lst_r)\nfor i in range(a-x):\n _ = heappop(lst_r)\n\nheapify(lst_g)\nfor i in range(b-y):\n _ = heappop(lst_g)\n \nheapify(lst_n)\n\nflg = lst_r > lst_g\n\n\nwhile len(lst_n)>=0:\n cur = -1 * heappop(lst_n)\n if flg and cur > lst_g[0]:\n _ = heappushpop(lst_g,cur)\n flg = lst_r > lst_g\n elif (not flg) and cur > lst_r[0]:\n _ = heappushpop(lst_r,cur)\n flg = lst_r > lst_g\n else:\n break\nprint(sum(lst_g)+sum(lst_r))', 'x,y,a,b,c = map(int,input().split())\nlst_r = list(map(int,input().split()))\nlst_g = list(map(int,input().split()))\nlst_n = list(map(lambda x:int(x)*(-1),input().split()))\nfrom heapq import *\n\nheapify(lst_r)\nfor i in range(a-x):\n _ = heappop(lst_r)\n\nheapify(lst_g)\nfor i in range(b-y):\n _ = heappop(lst_g)\n \nheapify(lst_n)\n\nflg = lst_r > lst_g\n\ncur = -1 * heappop(lst_n)\nwhile len(lst_n)>0:\n if flg and cur > lst_g[0]:\n _ = heappushpop(lst_g,cur)\n elif (not flg) and cur > lst_r[0]:\n _ = heappushpop(lst_r,cur)\n else:\n break\nprint(sum(lst_g)+sum(lst_r))', 'x,y,a,b,c = map(int,input().split())\nlst_r = list(map(int,input().split()))\nlst_g = list(map(int,input().split()))\nlst_n = list(map(int,input().split()))\nlst_r = sorted(lst_r, ascending=False)[:x]\nlst_g = sorted(lst_g, ascending=False)[:y]\nlst_all = sorted(lst_r + lst_g + lst_n, ascending=False)[:x+y]\nprint(sum(lst_all))', 'x,y,a,b,c = map(int,input().split())\nlst_r = list(map(int,input().split()))\nlst_g = list(map(int,input().split()))\nlst_n = list(map(int,input().split()))\nlst_r = sorted(lst_r, reverse=True)[:x]\nlst_g = sorted(lst_g, reverse=True)[:y]\nlst_all = sorted(lst_r + lst_g + lst_n, reverse=True)[:x+y]\nprint(sum(lst_all))']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s214010355', 's462673940', 's669988519', 's693592139']
[23328.0, 23328.0, 23328.0, 23328.0]
[354.0, 240.0, 88.0, 237.0]
[653, 591, 322, 313]
p02727
u438662618
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import heapq\n\nx, y, a, b, c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(lambda x :-int(x), input().split()))\n\np.sort(reverse=True)\nq.sort(reverse=True)\n\np = p[:x]\nq = q[:y]\n\npq = p+q\npq.sort(reverse=True)\n\nheapq.heapify(r)\nans = 0\n\nfor i in range(x+y) :\n print(i, pq[i], -r[0])\n if len(r) != 0 :\n if pq[i] < -r[0] :\n ans += -heapq.heappop(r)\n else :\n ans += pq[i]\n\nprint(ans)\n', 'import heapq\n\nx, y, a, b, c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np.sort(reverse=True)\nq.sort(reverse=True)\npq = p[:x]+q[:y]\nheapq.heapify(pq)\n\nfor e in r :\n heapq.heappushpop(pq, e)\n\nprint(sum(pq))\n']
['Runtime Error', 'Accepted']
['s209022623', 's655270045']
[25192.0, 23456.0]
[660.0, 229.0]
[488, 301]
p02727
u459554582
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['def merge(A,B):\n C = []\n \n while len(A)!=0 and len(B) != 0:\n if A[0]>B[0]:\n C.append(A[0])\n del A[0]\n else:\n C.append(B[0])\n del B[0]\n\n if len(A)>len(B):\n C.extend(A)\n else:\n C.extend(B)\n\n return C\n\nif __name__ == "__main__":\n X,Y,A,B,C = map(int,input().split())\n P = list(map(int,input().split()))\n Q = list(map(int,input().split()))\n R = list(map(int,input().split()))\n\n \n # P = [1,23,4,1,2]\n # Q = [4,3,56]\n # R = [70,20,1]\n\n P.sort(reverse=True)\n Q.sort(reverse=True)\n R.sort(reverse=True)\n\n S = merge(P[:X],Q[:Y])\n S = merge(S,R)\n\n print(S)\n \n score = 0\n for i in range(X+Y):\n score += S[i]\n print(score)\n\n', 'def merge(A,B):\n C = []\n i = 0\n j = 0\n while i < len(A) and j < len(B):\n if A[i]>B[j]:\n C.append(A[i])\n i += 1\n else:\n C.append(B[j])\n j += 1\n\n if len(A)-i>len(B)-j:\n C.extend(A[i:])\n else:\n C.extend(B[j:])\n\n return C\n\nX,Y,A,B,C = map(int,input().split())\nP = list(map(int,input().split()))\nQ = list(map(int,input().split()))\nR = list(map(int,input().split()))\n\n# P = [3,63,12,5,6]\n# Q = [3,5,6,7,8]\n# R = [13,5,6,8,23,5]\n# X = 3\n# Y = 2\n\n# P = [63,12,6]\n# Q = [8,7]\n\n\n# j = 2\n# C = [63,12,8,7]\n\n\nP.sort(reverse=True)\nQ.sort(reverse=True)\nR.sort(reverse=True)\n\nS = merge(P[:X],Q[:Y])\nS = merge(S,R)\n\nscore = 0\nfor i in range(X+Y):\n score += S[i]\nprint(score)\n\n']
['Wrong Answer', 'Accepted']
['s215184375', 's006995458']
[23328.0, 23328.0]
[2105.0, 379.0]
[777, 763]
p02727
u459590249
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c=map(int,input().split())\np=sorted(list(map(int, input().split())))[a-x:]\nq=sorted(list(map(int, input().split())))[b-y:]\nr=sorted(list(map(int, input().split())),reverse=True)\nimport heapq\neat=p+q\nheapq.heapify(eat)\nfor i in r:\n\tj=heapq.heappop(eat)\n\tif j<i:\n\t\theapq.heappush(eat,i)\n\telse:\n\t\theapq.heappush(eat,j)\nprint(list(eat))\nprint(sum(list(eat)))', 'x,y,a,b,c=map(int,input().split())\np=sorted(list(map(int, input().split())))[a-x:]\nq=sorted(list(map(int, input().split())))[b-y:]\nr=sorted(list(map(int, input().split())),reverse=True)\nimport heapq\neat=p+q\nheapq.heapify(eat)\nfor i in r:\n\tj=heapq.heappop(eat)\n\tif j<i:\n\t\theapq.heappush(eat,i)\n\telse:\n\t\theapq.heappush(eat,j)\n#print(list(eat))\nprint(sum(list(eat)))']
['Wrong Answer', 'Accepted']
['s512833738', 's635912304']
[25572.0, 22504.0]
[368.0, 326.0]
[362, 363]
p02727
u462329577
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['#!/usr/bin/env python3\nx,y,a,b,c = map(int,input().split())\np = list(map(int,input().split()))\nq = list(map(int,input().split()))\nr = list(map(int,input().split()))\np.sort()\nq.sort()\nz = p[-x:].extend(q[-y:]).extend(r)\nz.sort()\nprint(sum(z[-x-y:]))', '#!/usr/bin/env python3\nx,y,a,b,c = map(int,input().split())\np = list(map(int,input().split()))\nq = list(map(int,input().split()))\nr = list(map(int,input().split()))\np.sort()\nq.sort()\nz = p[-x:].extend(q[-y:]).extend(r)\nz.sort()\nprint(sum(z[-x-y]))', '#!/usr/bin/env python3\nx,y,a,b,c = map(int,input().split())\np = list(map(int,input().split()))\nq = list(map(int,input().split()))\nr = list(map(int,input().split()))\np.sort()\nq.sort()\nz = p[-x:]\nz.extend(q[-y:])\nz.extend(r)\nz.sort()\n#print(z)\nprint(sum(z[-x-y:]))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s354706526', 's834107956', 's823035299']
[23328.0, 23328.0, 23328.0]
[162.0, 164.0, 229.0]
[248, 247, 262]
p02727
u471539833
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\np=[:X]\nq=[:Y]\nr=[:max(X,Y)]\np.sort()\nq.sort()\np.reverse()\nq.reverse()\n \na=p[:]\na.extend(q)\na.extend(r)\na.sort()\na.reverse()\nb=q[:]\nb.extend(r)\nb.sort()\nb.reverse()\nc=p[:]\nc.extend(r)\nc.sort()\nc.reverse()\nred=0\ngreen=0\nsum=0\nsum1=0\nsum2=0\nd=0\nfor i in range(X+Y):\n if(a[i] in p):\n red+=1\n elif(a[i] in q):\n green+=1\n d+=a[i]\n \n if(i<X):\n sum1+=p[i]\n sum2+=c[i]\n if(i<Y):\n sum1+=b[i]\n sum2+=q[i]\n \nif(red<=X and green<=Y):\n print(d)\nelif(red>X):\n print(sum1)\nelif(green>Y):\n print(sum2)', 'X,Y,A,B,C=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\n\np.sort()\nq.sort()\np.reverse()\nq.reverse()\n\na=p[:]\na.extend(q)\na.extend(r)\na.sort()\na.reverse()\nb=q[:]\nb.extend(r)\nb.sort()\nb.reverse()\nc=q[:]\nc.extend(r)\nc.sort()\nc.reverse()\nred=0\ngreen=0\nsum=0\nsum1=0\nsum2=0\nd=0\nfor i in range(X+Y):\n if(a[i] in p):\n red+=1\n elif(a[i] in q):\n green+=1\n d+=a[i]\n \n if(i<X):\n sum1+=p[i]\n sum2+=b[i]\n if(i<Y):\n sum1+=b[i]\n sum2+=q[i]\n \nif(red<=X and green<=Y):\n print(d)\nelif(red>X):\n print(sum1)\nelif(green>Y):\n print(sum2)', 'X,Y,A,B,C=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\n\np.sort()\nq.sort()\np.reverse()\nq.reverse()\n\na=p[:]\na.extend(q)\na.extend(r)\na.sort()\na.reverse()\nb=q[:]\nb.extend(r)\nb.sort()\nb.reverse()\nc=p[:]\nc.extend(r)\nc.sort()\nc.reverse()\nred=0\ngreen=0\nsum=0\nsum1=0\nsum2=0\nd=0\nfor i in range((X+Y)*2):\n if(a[i] in p):\n red+=1\n elif(a[i] in q):\n green+=1\n d+=a[i]\n if(red>X and i-X-Y+1+green==Y):\n break\n if(i<X):\n sum1+=p[i]\n sum2+=c[i]\n if(i<Y):\n sum1+=b[i]\n sum2+=q[i]\n if(i==X+Y and red<=X and green<=Y):\n print(d)\n break\n if(red>X and i-X-Y+1+green==Y):\n print(sum1)\n break\n elif(green>Y and i-X-Y+1+red==X):\n print(sum2)\n break', 'X,Y,A,B,C=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\n\np.sort()\nq.sort()\np.reverse()\nq.reverse()\n\na=p[:]\na.extend(q)\na.extend(r)\na.sort()\na.reverse()\nb=q[:]\nb.extend(r)\nb.sort()\nb.reverse()\nc=p[:]\nc.extend(r)\nc.sort()\nc.reverse()\nred=0\ngreen=0\nsum=0\nsum1=0\nsum2=0\nd=0\nfor i in range((X+Y)*2):\n if(a[i] in p):\n red+=1\n elif(a[i] in q):\n green+=1\n d+=a[i]\n if(red>X and i-X-Y+1+green==Y):\n break\n if(i<X):\n sum1+=p[i]\n sum2+=c[i]\n if(i<Y):\n sum1+=b[i]\n sum2+=q[i]\n if(i==X+Y and red<=X and green<=Y):\n print(sum)\n break\n if(red>X and i-X-Y+1+green==Y):\n print(sum1)\n break\n elif(green>Y and i-X-Y+1+red==X):\n print(sum2)\n break', 'X,Y,A,B,C=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\np.sort()\nq.sort()\np.reverse()\nq.reverse()\np=p[:X]\nq=q[:Y]\n \na=p[:]\na.extend(q)\na.extend(r)\na.sort()\na.reverse()\nsum=0\nfor i in range(X+Y):\n sum+=a[i]\nprint(sum)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s456405992', 's468880298', 's913628594', 's931535817', 's642675259']
[2940.0, 3064.0, 24484.0, 24624.0, 23328.0]
[17.0, 17.0, 2105.0, 2105.0, 262.0]
[655, 629, 759, 761, 295]
p02727
u479353489
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C = [int(x) for x in input().split()]\nR = [int(x) for x in input().split()]\nG = [int(x) for x in input().split()]\nCL = [int(x) for x in input().split()]\n\ndp = [[0]*(X+1) for d in range(Y+1)]\nfor i in range(X):\n for j in range(Y):\n MAX = max(max(R[j],CL[j]),max(G[i],CL[i]))\n dp[i][j] = MAX\n if MAX == R[j]:\n A.pop(0)\n elif MAX == G[i]:\n B.pop(0)\n else:\n C.pop(0)\n\nprint(dp[-1])', 'X,Y,A,B,C = [int(x) for x in input().split()]\nR = sorted([int(x) for x in input().split()],reverse = True)[:X]\nG = sorted([int(x) for x in input().split()],reverse = True)[:Y]\nCL = sorted([int(x) for x in input().split()],reverse = True)[:X+Y]\ntotal = sorted(R+G+CL, reverse=True)[:X+Y]\nprint(sum(total))']
['Runtime Error', 'Accepted']
['s345241206', 's936970748']
[1937072.0, 22432.0]
[2224.0, 256.0]
[456, 304]
p02727
u479719434
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C = map(int, input().split())\np = map(int, input().split())\nq = map(int, input().split())\nr = map(int, input().split())\n\n# X, Y, A, B, C = 1, 2, 2, 2, 1\n# p = [2, 4]\n\n# r = [3]\n\np.sort()\nq.sort()\nr.sort()\np = p[-X:]\nq = q[-Y:]\n\nd = []\nd += p\nd += q\nd += r\nd.sort()\n\nprint(sum(d[-X-Y:]))\n', 'X, Y, A, B, C = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\n# X, Y, A, B, C = 1, 2, 2, 2, 1\n# p = [2, 4]\n\n# r = [3]\n\np.sort()\nq.sort()\nr.sort()\np = p[-X:]\nq = q[-Y:]\n\nd = []\nd += p\nd += q\nd += r\nd.sort()\n\nprint(sum(d[-X-Y:]))\n']
['Runtime Error', 'Accepted']
['s548798773', 's244222382']
[26844.0, 23328.0]
[49.0, 243.0]
[311, 329]
p02727
u485566817
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\np = sorted(list(map(int, input().split())), reverse=True)\nq = sorted(list(map(int, input().split())), reverse=True)\nr = sorted(list(map(int, input().split())), reverse=True)\n\nresult = sum(p[:x]) + sum(q[:y])\ni = 0\nred_min = x-1\nblue_min = y-1\nflag = True\n\nwhile flag == True:\n if r[i] > p[red_min] or r[i] > q[blue_min]:\n if p[red_min] < q[blue_min]:\n result = result - p[red_min] + r[i]\n i += 1\n red_min -= 1\n else:\n result = result - q[blue_min] + r[i]\n i += 1\n blue_min -= 1\n else:\n flag = False\nprint(result)\n ', 'x, y, a, b, c = map(int, input().split())\np = sorted(list(map(int, input().split())), reverse=True)\nq = sorted(list(map(int, input().split())), reverse=True)\nr = sorted(list(map(int, input().split())), reverse=True)\n\np.insert(0, 10**9)\np.append(0)\nq.insert(0, 10**9)\nq.append(0)\nr.append(0)\n\nresult = sum(p[1:x+1]) + sum(q[1:y+1])\ni = 0\nred_min = x\nblue_min = y\nflag = True\n\nwhile flag == True:\n if r[i] > p[red_min] or r[i] > q[blue_min]:\n if p[red_min] < q[blue_min]:\n result = result - p[red_min] + r[i]\n i += 1\n red_min -= 1\n else:\n result = result - q[blue_min] + r[i]\n i += 1\n blue_min -= 1\n else:\n flag = False\nprint(result)']
['Runtime Error', 'Accepted']
['s622758455', 's415989543']
[22720.0, 22720.0]
[271.0, 277.0]
[652, 724]
p02727
u497046426
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C = map(int, input().split())\n*P, = map(int, input().split())\n*Q, = map(int, input().split())\n*R, = map(int, input().split())\nP, Q = sorted(P, reverse=True), sorted(Q, reverse=True)\nP, Q = P[:A], Q[:B]\nans = sum(sorted(P + Q + R, reverse=True)[:A + B])\nprint(ans)', 'X, Y, A, B, C = map(int, input().split())\n*P, = map(int, input().split())\n*Q, = map(int, input().split())\n*R, = map(int, input().split())\nP, Q = sorted(P, reverse=True), sorted(Q, reverse=True)\nP, Q = P[:X], Q[:Y]\nans = sum(sorted(P + Q + R, reverse=True)[:X + Y])\nprint(ans)']
['Wrong Answer', 'Accepted']
['s969693289', 's641092778']
[23328.0, 22560.0]
[241.0, 237.0]
[275, 275]
p02727
u509392332
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\n\nA_p = p[:X]\nB_q = q[:Y]\nC_r = r\n\nans = A_p + B_q + C_r\nans.sort(reverse=True)\nsum(ans[: X+Y])', 'X, Y, A, B, C = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n \np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\n \nA_p = p[:X]\nB_q = q[:Y]\nC_r = r\n \nans = A_p + B_q + C_r\nans.sort(reverse=True)\nprint(sum(ans[: X+Y]))']
['Wrong Answer', 'Accepted']
['s166462471', 's072528116']
[22720.0, 23328.0]
[240.0, 249.0]
[308, 318]
p02727
u512099209
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import heapq\nfrom collections import deque\n\nX, Y, A, B, C = list(map(int, input().split()))\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np.sort()\nq.sort()\nr.sort()\n\npq = deque((heapq.merge(p[A - X:], q[B - Y:])))\nr = deque(r)\n\nwhile pq[0] < r[-1]:\n pq.popleft()\n pq.append(r.pop())\n\nprint(sum(pq))', 'import heapq\nfrom collections import deque\n\nX, Y, A, B, C = list(map(int, input().split()))\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\nr.sort()\n\nif A < X:\n p += r[C - (X - A):]\n r = r[:C - (X - A)]\n A = X\n\nif B < Y:\n q += r[C - (Y - B):]\n r = r[:C - (Y - B)]\n B = Y\n\np.sort()\nq.sort()\n\npq = deque((heapq.merge(p[A - X:], q[B - Y:])))\n\nwhile pq[0] < r[-1]:\n pq.popleft()\n pq.append(r.pop())\n\nprint(sum(pq))', 'import heapq\nfrom collections import deque\n\nX, Y, A, B, C = list(map(int, input().split()))\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\nr.sort()\n\nif A < X:\n p += r[-(X - A):]\n r = r[:-(X - A)]\n A = X\n\nif B < Y:\n q += r[-(Y - B):]\n r = r[:-(Y - B)]\n B = Y\n\np.sort()\nq.sort()\n\npq = deque((heapq.merge(p[A - X:], q[B - Y:])))\n\nwhile pq[0] < r[-1]:\n pq.popleft()\n pq.append(r.pop())\n\nprint(sum(pq))', 'import heapq\nfrom collections import deque\n\nX, Y, A, B, C = list(map(int, input().split()))\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\nr.sort()\n\nif A < X:\n p += r[-(X - A):]\n r = r[:-(X - A)]\n A = X\n\nif B < Y:\n q += r[-(Y - B):]\n r = r[:-(Y - B)]\n B = Y\n\np.sort()\nq.sort()\n\npq = deque(heapq.merge(p[A - X:], q[B - Y:]))\n\nwhile r and pq[0] < r[-1]:\n pq.popleft()\n pq.append(r.pop())\n\nprint(sum(pq))\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s059018133', 's693323166', 's853154922', 's934376704']
[23616.0, 23604.0, 23616.0, 23592.0]
[276.0, 324.0, 286.0, 280.0]
[363, 479, 467, 472]
p02727
u512212329
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\nred = [int(x) for x in input().split()]\ngreen = [int(x) for x in input().split()]\nred.sort(reverse=True)\ngreen.sort(reverse=True)\ncandidates = [int(x) for x in input().split()] + red[x:] + green[:y]\ncandidates.sort(reverse=True)\nprint(sum(candidates[:x+y]))', 'x, y, a, b, c = map(int, input().split())\nprint(sum(sorted(\n sorted(int(x) for x in input().split())[-x:] +\n sorted(int(x) for x in input().split())[-y:] +\n [int(x) for x in input().split()])[-(x+y):]))']
['Wrong Answer', 'Accepted']
['s048296324', 's474233260']
[23340.0, 22400.0]
[234.0, 245.0]
[299, 211]
p02727
u515740713
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import sys \nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nX,Y,A,B,C = map(int,readline().split())\nP = list(map(int,readline().split()))\nQ = list(map(int,readline().split()))\nR = list(map(int,readline().split()))\nP = sorted(P,reverse=True)\nQ = sorted(Q,reverse=True)\nR = sorted(R,reverse=True)\nP = P[:X]\nQ = Q[:Y]\nPQ = sorted(P+Q,reverse = True)\nXY = X+Y\ntotal = sum(PQ)\nfor i in range(C):\n if R[i] < PQ[-(i+1)]:\n if i ==0:\n ans = total\n else:\n ans = total + sum(R[:i]) - sum(PQ[-i:])\n break\n if i == max(C-1,XY-1):\n ans = total + sum(R[:i+1]) - sum(PQ[-(i+1):])\nprint(ans)', 'import sys \nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nX,Y,A,B,C = map(int,readline().split())\nP = list(map(int,readline().split()))\nQ = list(map(int,readline().split()))\nR = list(map(int,readline().split()))\nP = sorted(P,reverse=True)\nQ = sorted(Q,reverse=True)\nR = sorted(R,reverse=True)\nP = P[:X]\nQ = Q[:Y]\nPQR = sorted(P+Q+R,reverse = True)\nans = sum(PQR[:X+Y])\nprint(ans)']
['Runtime Error', 'Accepted']
['s838522622', 's450769601']
[27448.0, 27384.0]
[186.0, 156.0]
[671, 438]
p02727
u518064858
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c=map(int,input().split())\np=sorted(list(map(int,input().split())),reverse=True)\nq=sorted(list(map(int,input().split())),reverse=True)\nr=sorted(list(map(int,input().split())),reverse=True)\np2=p[:x]\nq2=q[:y]\nmemop=x-1\nmemoq=y-1\nsp=sum(p2)\nsq=sum(q2)\nk=0\nflagp=0\nflagq=0\nwhile k<c:\n if memop<0:\n flagp=1\n if memoq<0:\n flagq=1\n if flagp*flagq==1:\n print(sp+sq)\n exit()\n elif flagq==1:\n if p2[memop]>=r[k]:\n print(sp+sq)\n exit()\n else:\n sp-=p2[memop]\n sp+=r[k]\n k+=1\n memop-=1\n elif flagp==1:\n if q2[memoq]>=r[k]:\n print(sp+sq)\n exit()\n else:\n sq-=q2[memoq]\n sq+=r[k]\n k+=1\n memoq-=1\n elif p2[memop]>=r[k] and q2[memoq]>=r[k] and flagp+flagq==0:\n print(sp+sq)\n exit()\n elif p2[memop]>q2[memoq]:\n sq-=q2[memoq]\n sq+=r[k]\n k+=1\n memoq-=1\n elif p2[memop]<=q2[memoq]:\n sp-=p2[memop]\n sp+=r[k]\n k+=1\n memop-=1\n', 'x,y,a,b,c=map(int,input().split())\np=sorted(list(map(int,input().split())),reverse=True)\nq=sorted(list(map(int,input().split())),reverse=True)\nr=sorted(list(map(int,input().split())),reverse=True)\np2=p[:x]\nq2=q[:y]\nmemop=x-1\nmemoq=y-1\nsp=sum(p2)\nsq=sum(q2)\nk=0\nflagp=0\nflagq=0\nwhile k<c:\n if memop<0:\n flagp=1\n if memoq<0:\n flagq=1\n if flagp*flagq==1:\n print(sp+sq)\n exit()\n elif flagq==1:\n if p2[memop]>=r[k]:\n print(sp+sq)\n exit()\n else:\n sp-=p2[memop]\n sp+=r[k]\n k+=1\n memop-=1\n elif flagp==1:\n if q2[memoq]>=r[k]:\n print(sp+sq)\n exit()\n else:\n sq-=q2[memoq]\n sq+=r[k]\n k+=1\n memoq-=1\n elif p2[memop]>=r[k] and q2[memoq]>=r[k] and flagp+flagq==0:\n print(sp+sq)\n exit()\n elif p2[memop]>q2[memoq]:\n sq-=q2[memoq]\n sq+=r[k]\n k+=1\n memoq-=1\n elif p2[memop]<=q2[memoq]:\n sp-=p2[memop]\n sp+=r[k]\n k+=1\n memop-=1\nprint(sp+sq)\n']
['Wrong Answer', 'Accepted']
['s191463081', 's467189038']
[22720.0, 22560.0]
[323.0, 318.0]
[1091, 1104]
p02727
u521323621
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np = sorted(p, reverse=True)\nq = sorted(q, reverse=True)\n\npq = sorted(p[:x] + q[:y])\nr = sorted(r)\nans=0\nj = r.pop()\nfor i in pq:\n if i < j:\n ans+=j\n j = 0\n if r:\n j = r.pop()\n else: break\n else:\n ans += i\n \nprint(ans)', 'x,y,a,b,c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np = sorted(p, reverse=True)\nq = sorted(q, reverse=True)\n\npq = sorted(p[:x] + q[:y])\nr = sorted(r)\nans=0\nj = r.pop()\nfor i in pq:\n if i < j:\n ans += j\n j = 0\n if r:\n j = r.pop()\n else:\n ans += i\n \nprint(ans)']
['Wrong Answer', 'Accepted']
['s662086212', 's915035995']
[29332.0, 29664.0]
[184.0, 194.0]
[389, 375]
p02727
u535236942
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\nl = p[:x] + q[:y] + r\nl.sort(reverse=True)\n\nprint(sum(l[:x+y]))', 'x, y, a, b, c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np.sort(reverse=True)\nq.sort(reverse=True)\n\nl = p[:x] + q[:y] + r\nl.sort(reverse=True)\n\nprint(sum(l[:x+y]))']
['Wrong Answer', 'Accepted']
['s043566491', 's665521071']
[23328.0, 23328.0]
[218.0, 278.0]
[214, 257]
p02727
u539969758
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X, Y, A, B, C =map(int,input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\n\np_ind = X-1\nq_ind = Y-1\nr_ind = 0\n\nwhile 1:\n\n print(p_ind, q_ind, r_ind)\n if p_ind == -1 and q_ind == -1:\n break\n\n if q_ind == -1 or p[p_ind] < q[q_ind]:\n worst = p[p_ind]\n apple = "p"\n else:\n worst = q[q_ind]\n apple = "q"\n \n if worst <= r[r_ind]:\n r_ind += 1\n if apple == "p":\n p_ind -= 1\n else:\n q_ind -= 1\n \n if r_ind == C:\n break\n else:\n break\n\neat_p = p[:p_ind+1]\neat_q = q[:q_ind+1]\neat_r = r[:r_ind]\n\nif p_ind == -1:\n eat_p = []\nif q_ind == -1:\n eat_q = []\n\nprint(sum(eat_p) + sum(eat_q) + sum(eat_r))', 'X, Y, A, B, C =map(int,input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\n\np_ind = X-1\nq_ind = Y-1\nr_ind = 0\n\nwhile 1:\n\n if p_ind == -1 and q_ind == -1:\n break\n\n if q_ind == -1 or p[p_ind] < q[q_ind]:\n worst = p[p_ind]\n apple = "p"\n else:\n worst = q[q_ind]\n apple = "q"\n \n if worst <= r[r_ind]:\n r_ind += 1\n if apple == "p":\n p_ind -= 1\n else:\n q_ind -= 1\n \n if r_ind == C:\n break\n else:\n break\n\neat_p = p[:p_ind+1]\neat_q = q[:q_ind+1]\neat_r = r[:r_ind]\n\nif p_ind == -1:\n eat_p = []\nif q_ind == -1:\n eat_q = []\n\n\nprint(sum(eat_p) + sum(eat_q) + sum(eat_r))']
['Wrong Answer', 'Accepted']
['s994259938', 's985645552']
[22720.0, 23360.0]
[451.0, 273.0]
[862, 832]
p02727
u547608423
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\n\np=sorted(p,reverse=True)\nq=sorted(q,reverse=True)\nr=sorted(r,reverse=True)\nanswer=p[:X]+q[:Y]\nsum=0\nanswer=sorted(answer,reverse=True)\ni=0\n\nwhile answer[-i-1]<r[i]:\n answer[-i-1]=r[i]\n i+=1\n\nfor a in answer:\n sum+=a\n\nprint(sum)', 'X,Y,A,B,C=map(int,input().split())\np=list(map(int,input().split()))\nq=list(map(int,input().split()))\nr=list(map(int,input().split()))\n\np=sorted(p,reverse=True)\nq=sorted(q,reverse=True)\nr=sorted(r,reverse=True)\nanswer=p[:X]+q[:Y]\nsum=0\nanswer=sorted(answer)\ni=0\n\nwhile i<=min(X+Y-1,C-1) and answer[i]<r[i]:\n answer[i]=r[i]\n i+=1\n\nfor a in answer:\n sum+=a\n\nprint(sum)']
['Runtime Error', 'Accepted']
['s655737412', 's944096622']
[22720.0, 22720.0]
[268.0, 293.0]
[371, 374]
p02727
u551056021
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['s = []\nr.extend( [0 for i in range(x+y)])\np.sort()\nq.sort()\nr.sort()\n\n\nfor i in range(x):\n if p[-1]>= r[-1]:\n s.append(p.pop())\n else:\n s.append(r.pop())\n \nfor i in range(y):\n if q[-1]>= r[-1]:\n s.append(q.pop())\n else:\n s.append(r.pop())\n \nprint(sum(s))', 'x, y, a, b, c = [int(t) for t in input().split()]\np = [int(t) for t in input().split()]\nq = [int(t) for t in input().split()]\nr = [int(t) for t in input().split()]\n\ns = []\np.sort(reverse=True)\np = p[:x]\n\nq.sort(reverse=True)\nq = q[:y]\n\ns = p + q + r\ns.sort(reverse=True)\ns = s[:x+y]\nprint(sum(s))']
['Runtime Error', 'Accepted']
['s378130433', 's357913058']
[3064.0, 23644.0]
[18.0, 243.0]
[306, 296]
p02727
u564837886
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\n\nl = p[:x] + q[:y]\nl.sort()\n\ni = 0\nwhile l[i] < r[i] and i < len(l) and i < len(r):\n l[i] = r[i]\n i += 1\n\nprint(sum(l))', 'x, y, a, b, c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\np.sort(reverse=True)\nq.sort(reverse=True)\nr.sort(reverse=True)\n\nl = p[:x] + q[:y]\nl.sort()\n\ni = 0\nwhile i < len(l) and i < len(r):\n if l[i] < r[i]:\n l[i] = r[i]\n i += 1\n else:\n break\n\nprint(sum(l))']
['Runtime Error', 'Accepted']
['s854776605', 's636075127']
[23328.0, 23328.0]
[260.0, 282.0]
[339, 359]
p02727
u566159623
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\np =list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\np = sorted(p)\nq = sorted(q)\n\np = p[(len(p)-x):]\nq = q[(len(q)-y):]\nr.append(p)\nr.append(q)\nr = sorted(r)\nprint(sum(r[(len(r)-x-y):]))\n', 'x, y, a, b, c = map(int, input().split())\np =list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\np = sorted(p)\nq = sorted(q)\n\np = p[(len(p)-x):]\nq = q[(len(q)-y):]\nr.append(p)\nr.append(q)\nsort(r)\nprint(sum(r[(len(r)-x-y):]))\n', 'x, y, a, b, c = map(int, input().split())\np =list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\np = sorted(p)\nq = sorted(q)\n\np = p[(len(p)-x):]\nq = q[(len(q)-y):]\nr = r + p\nr = r + q\nr = sorted(r)\nprint(sum(r[(len(r)-x-y):]))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s064887502', 's291534530', 's771622974']
[23328.0, 23328.0, 23328.0]
[195.0, 166.0, 246.0]
[283, 277, 279]
p02727
u572343785
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C = map(int,input().split())\n\np = sorted(list(map(int,input().split()))) #A\nq = sorted(list(map(int,input().split()))) #B\nr = sorted(list(map(int,input().split()))) #C\n\nxlist = p[-X:] #X\nylist = q[-Y:] #Y\n\n\nfor i in range(min(X,Y)):\n if xlist[i] < ylist[i] and min(xlist) < max(r):\n xlist.remove(min(xlist))\n xlist.append(max(r))\n r.pop()\n elif ylist[i] < xlist[i] and min(ylist) < max(r):\n ylist.remove(min(xlist))\n ylist.append(max(r))\n r.pop()\n else:\n continue\n\nprint(sum(xlist)+sum(ylist))', 'X,Y,A,B,C = map(int,input().split())\n\np = sorted(list(map(int,input().split()))) #A\nq = sorted(list(map(int,input().split()))) #B\nr = sorted(list(map(int,input().split()))) #C\n\nxlist = p[-X:] #X\nylist = q[-Y:] #Y\n\n"""\ndef main(X,Y,xlist,ylist,r):\n for i in range(min(X,Y)):\n if xlist[i] < ylist[i] and min(xlist) < max(r):\n xlist.remove(min(xlist))\n xlist.append(r.pop())\n \n elif ylist[i] < xlist[i] and min(ylist) < max(r):\n ylist.remove(min(ylist))\n ylist.append(r.pop())\n \n elif min(xlist) >= max(r) and min(ylist) >= max(r):\n break\n else:\n continue\n \n print(sum(xlist + ylist))\n\nmain(X,Y,xlist,ylist,r)\n"""\nall_apples = sorted(xlist + ylist + r)\nprint(sum(all_apples[-(X+Y):]))\n\n\n\n\n\n']
['Runtime Error', 'Accepted']
['s022931801', 's941104619']
[23200.0, 23456.0]
[2104.0, 285.0]
[559, 812]
p02727
u580404776
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C=map(int,input().split())\nred=sorted(list(map(int,input().split())),reverse=True)\ngreen=sorted(list(map(int,input().split())),reverse=True)\nnocolor=sorted(list(map(int,input().split())),reverse=True)\n\nX_cnt=0\nY_cnt=0\nans=[]\n\nfor i in range(X):\n ans.append(red[i])\n X_cnt+=1\n if X_cnt==X:\n break\n elif X_cnt<X:\n continue\nfor i in range(Y):\n ans.append(green[i])\n Y_cnt+=1\n if Y_cnt==Y:\n break\n elif Y_cnt<Y:\n continue\n\nans=sorted(ans)\nans_sum=sum(ans) \nfor i in range(C):\n if ans[i]<nocolor[i]:\n ans_sum=ans_sum_nocolor[i]-ans[i]\n \nprint(ans_sum)\n\n', 'X,Y,A,B,C=map(int,input().split())\nR=sorted(list(map(int,input().split())),reverse=True)\nG=sorted(list(map(int,input().split())),reverse=True)\nRG=sorted(list(map(int,input().split())),reverse=True)\n\n\nd=R[:X]+G[:Y]+RG\nd.sort(reverse=True)\n \nprint(sum(d[:X+Y]))']
['Runtime Error', 'Accepted']
['s665013282', 's896136311']
[23200.0, 22720.0]
[304.0, 250.0]
[628, 259]
p02727
u585963734
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
["#from typing import MutableSequence\n\ndef qsort(a: int, left: int, right: int) -> None:\n pl=left\n pr=right\n x=a[(left+right)//2]\n\n while pl<=pr:\n while a[pl]>x: pl+=1 \n while a[pr]<x: pr-=1\n if pl <= pr:\n a[pl],a[pr] = a[pr],a[pl]\n pl+=1\n pr-=1\n \n if left <pr: qsort(a,left,pr)\n if right >pl: qsort(a,pl,right)\n \ndef quick_sort(a: int) -> None:\n qsort(a,0,len(a)-1)\n \nif __name__ == '__main__':\n X,Y,A,B,C = map(int, input().split())\n p=list(map(int,input().split()))\n q=list(map(int,input().split()))\n r=list(map(int,input().split()))\n\n quick_sort(p)\n quick_sort(q)\n quick_sort(r)\n print(p)\n print(q)\n\n j=0\n k=0\n for i in range(C):\n if p[X-j-1] < r[i] and q[Y-k-1] < r[i]:\n if q[Y-k-1] < p[X-j-1]:\n q[Y-k-1]=r[i]\n k+=1\n else:\n p[X-j-1]=r[i]\n j+=1\n elif p[X-j-1] < r[i]:\n p[X-j-1]=r[i]\n j+=1\n elif q[Y-k-1] < r[i]:\n q[Y-k-1] = r[i]\n k+=1\n \n #print(i)\n #print(p)\n #print(q)\n \n x=0\n for i in range(X):\n x+=p[i]\n for i in range(Y):\n x+=q[i]\n print(x)", "X,Y,A,B,C=map(int, input().split())\np=list(map(int, input().split()))\nq=list(map(int, input().split()))\nr=list(map(int, input().split()))\n\nx=X-1\ny=Y-1\n\np=sorted(p,reverse=True)\nq=sorted(q,reverse=True)\nr=sorted(r,reverse=True)\n\n#print(p[:X],q[:Y])\n\nif p[x]>=q[y]:\n a=q[y]\n f=1\nelse:\n a=p[x]\n f=2\nwhile a<r[0] and len(r)>=1:\n# print(a,r[0])\n if f==1 :\n# print('f=1')\n q[y]=r[0]\n y-=1\n r.pop(0)\n elif f==2 :\n# print('f=2')\n p[x]=r[0]\n x-=1\n r.pop(0)\n else:\n# print('break1')\n break\n \n# print(x,y,p[x],q[y])\n \n if (y==-1 and x>=0) or (x>=0 and p[x]<q[y]):\n# print('a=p[x]')\n a=p[x]\n f=2\n elif (x==-1 and y>=0) or (y>=0 and p[x]>=q[y]):\n# print('a=q[y]')\n a=q[y]\n f=1\n else:\n# print('break2')\n break\n\nans=0\n#print(p[:X],q[:Y])\nfor i in p[:X]:\n ans+=i\nfor i in q[:Y]:\n ans+=i\n\nprint(ans)", "#from typing import MutableSequence\n\ndef qsort(a: int, left: int, right: int) -> None:\n pl=left\n pr=right\n x=a[(left+right)//2]\n\n while pl<=pr:\n while a[pl]>x: pl+=1 \n while a[pr]<x: pr-=1\n if pl <= pr:\n a[pl],a[pr] = a[pr],a[pl]\n pl+=1\n pr-=1\n \n if left <pr: qsort(a,left,pr)\n if right >pl: qsort(a,pl,right)\n \ndef quick_sort(a: int) -> None:\n qsort(a,0,len(a)-1)\n \nif __name__ == '__main__':\n X,Y,A,B,C = map(int, input().split())\n p=list(map(int,input().split()))\n q=list(map(int,input().split()))\n r=list(map(int,input().split()))\n\n quick_sort(p)\n quick_sort(q)\n quick_sort(r)\n print(p)\n print(q)\n\n j=0\n k=0\n for i in range(C):\n if p[X-j-1] < r[i] and q[Y-k-1] < r[i]:\n if q[Y-k-1] < p[X-j-1]:\n q[Y-k-1]=r[i]\n k+=1\n else:\n p[X-j-1]=r[i]\n j+=1\n elif p[X-j-1] < r[i]:\n p[X-j-1]=r[i]\n j+=1\n elif q[Y-k-1] < r[i]:\n q[Y-k-1] = r[i]\n k+=1\n \n print(i)\n print(p)\n print(q)\n \n x=0\n for i in range(X):\n x+=p[i]\n for i in range(Y):\n x+=q[i]\n print(x)\n", "X,Y,A,B,C=map(int, input().split())\np=list(map(int, input().split()))\nq=list(map(int, input().split()))\nr=list(map(int, input().split()))\n\nx=X-1\ny=Y-1\n\np=sorted(p,reverse=True)\nq=sorted(q,reverse=True)\nr=sorted(r,reverse=True)\n\n#print(p[:X],q[:Y])\n\nif p[x]>=q[y]:\n a=q[y]\n f=1\nelse:\n a=p[x]\n f=2\nwhile len(r)>=1 and a<r[0]:\n# print(a,r[0])\n if f==1 :\n# print('f=1')\n q[y]=r[0]\n y-=1\n r.pop(0)\n elif f==2 :\n# print('f=2')\n p[x]=r[0]\n x-=1\n r.pop(0)\n else:\n# print('break1')\n break\n \n# print(x,y,p[x],q[y])\n \n if (y==-1 and x>=0) or (x>=0 and p[x]<q[y]):\n# print('a=p[x]')\n a=p[x]\n f=2\n elif (x==-1 and y>=0) or (y>=0 and p[x]>=q[y]):\n# print('a=q[y]')\n a=q[y]\n f=1\n else:\n# print('break2')\n break\n\nans=0\n#print(p[:X],q[:Y])\nfor i in p[:X]:\n ans+=i\nfor i in q[:Y]:\n ans+=i\n\nprint(ans)"]
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s172888658', 's625308197', 's625669732', 's222591318']
[23328.0, 28904.0, 146792.0, 29028.0]
[1151.0, 833.0, 2105.0, 839.0]
[1101, 856, 1099, 856]
p02727
u589913372
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['import heapq as hp\nx,y,a,b,c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\nlp = hp.nlargest(x, p)\nlq = hp.nlargest(y, q)\npq = lp + lq\nlpq = hp.nlargest(x+y, pq)\nlr = hp.nlargest(c, r)\nd = min(len(lr),len(lpq))\nfor i in range(1,d):\n if lpq[x+y-i] < lr[i-1]:\n lpq[x+y-i] = lr[i-1]\n else:\n break\n\nans = 0\nfor i in range(0,len(lpq)):\n ans += lpq[i]\nprint(ans)', 'import heapq as hp\nx,y,a,b,c = map(int, input().split())\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\n\nlp = hp.nlargest(x, p)\nlq = hp.nlargest(y, q)\npq = lp + lq\nlpq = hp.nlargest(x+y, pq)\nlr = hp.nlargest(c, r)\nd = min(len(lr),len(lpq))\nfor i in range(1,d+1):\n if lpq[x+y-i] < lr[i-1]:\n lpq[x+y-i] = lr[i-1]\n else:\n break\n\nans = 0\nfor i in range(0,len(lpq)):\n ans += lpq[i]\nprint(ans)']
['Wrong Answer', 'Accepted']
['s484299302', 's981750256']
[30384.0, 32560.0]
[483.0, 472.0]
[455, 457]
p02727
u593855772
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['X,Y,A,B,C = map(int,input().split())\np = list(map(int,input().split()))\nq = list(map(int,input().split()))\nr = list(map(int,input().split()))\np.sort()\nq.sort()\nr.sort()\nr = sorted(r,reverse = True)\np = p[A-X:]\nq = q[B-Y:]\nif X+Y<C:\n r = r[:X+Y+1]\npx = 0\nqx = 0\nfor i in range(X+Y):\n if px == len(p) or qx ==len(q):\n break\n if min(p[px],q[qx],r[i]) ==p[px]:\n p[px] = r[i]\n px +=1\n elif min(p[px],q[qx],r[i]) ==q[qx]:\n q[qx] = r[i]\n qx += 1\n else:\n px += 1\n qx += 1\nprint(sum(p)+sum(q))', 'X,Y,A,B,C = map(int,input().split())\np = list(map(int,input().split()))\nq = list(map(int,input().split()))\nr = list(map(int,input().split()))\np.sort()\nq.sort()\nr.sort()\nr = sorted(r,reverse = True)\np = p[A-X:]\nq = q[B-Y:]\nif X+Y<C:\n r = r[:X+Y]\npx = 0\nqx = 0\nfor i in range(C):\n if px == len(p) and qx == len(q):\n break\n elif px == len(p):\n if min(q[qx],r[i])==q[qx]:\n q[qx] =r[i]\n qx += 1\n else:\n break\n elif qx == len(q):\n if min(p[px],r[i])==p[px]:\n p[px] =r[i]\n px += 1\n else:\n break\n else:\n if min(p[px],q[qx],r[i]) ==p[px]:\n p[px] = r[i]\n px +=1\n elif min(p[px],q[qx],r[i]) ==q[qx]:\n q[qx] = r[i]\n qx += 1\n else:\n break\nprint(sum(p)+sum(q))']
['Runtime Error', 'Accepted']
['s634852936', 's431462398']
[22720.0, 23216.0]
[349.0, 320.0]
[548, 838]
p02727
u594803920
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x,y,a,b,c = map(int, input().split())\nli_p = list(map(int, input().split()))\nli_q = list(map(int, input().split()))\nli_r = list(map(int, input().split()))\nli_p.sort(reverse=True)\nli_q.sort(reverse=True)\nli_r.sort(reverse=True)\np,q = [],[]\nfor i in range(x):\n r.append(li_p[i])\nfor i in range(y):\n r.append(li_q[i])\nfor i in range(c):\n r.append(li_r[i])\nr.sort(reverse=True)\nprint(sum(r[:x+y]))', 'from heapq import heapify, heappush, heappop\nx,y,a,b,c = map(int, input().split())\nli_p = list(map(int, input().split()))\nli_q = list(map(int, input().split()))\nli_r = list(map(int, input().split()))\nli_p.sort(reverse=True)\nli_q.sort(reverse=True)\nli_r.sort(reverse=True)\ns = 0\nfor i in range(x):\n s += li_p[i]\nfor i in range(y):\n s += li_q[i]\nli_p.extend(li_q)\nli_p.sort(reverse=True)\ns_p = [0] * (a+b+1)\ns_r = [0] * (c+1)\nfor i in range(1,a+b):\n s_p[i] = s_p[i-1] + li_p[i]\nfor i in range(1, c):\n s_r[i] = s_r[i-1] + li_r[i]\ndelta = -1\nzz = -1\nfor i in range(min(c, a+b)):\n k = s_r[i] - s_p[i]\n if k > delta:\n zz = i\n delta = k\nprint(s+delta)\n', 'x,y,a,b,c = map(int, input().split())\nli_p = list(map(int, input().split()))\nli_q = list(map(int, input().split()))\nli_r = list(map(int, input().split()))\nli_p.sort(reverse=True)\nli_q.sort(reverse=True)\nli_r.sort(reverse=True)\nr = []\nfor i in range(x):\n r.append(li_p[i])\nfor i in range(y):\n r.append(li_q[i])\nfor i in range(c):\n r.append(li_r[i])\nr.sort(reverse=True)\nprint(sum(r[:x+y]))\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s285972575', 's851933600', 's407918905']
[29364.0, 40504.0, 29604.0]
[143.0, 248.0, 214.0]
[396, 657, 392]
p02727
u602188782
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['# -*- coding: utf-8 -*-\n\ndef mergef(a,b):\n c = []\n h = j = 0\n while j<len(a) and h<len(b):\n if a[j]>b[h]:\n c.append(a[j])\n j+=1\n else:\n c.append(b[h])\n h+=1\n if j==len(a):\n for i in b[h:]:\n c.append(i)\n else:\n for i in a[j:]:\n c.append(i)\n return c\n\ndef merge_sortf(lists):\n if len(lists) <= 1:\n return lists\n middle = int(len(lists)/2)\n left = merge_sortf(lists[:middle])\n right = merge_sortf(lists[middle:])\n return mergef(left,right)\n\n\nX,Y,A,B,C= map(int,input().split())\np = list(map(int,input().split()))\nq = list(map(int,input().split()))\nr = list(map(int,input().split()))\n\npm=merge_sortf(p)\nqm=merge_sortf(q)\nrm=merge_sortf(r)\n\nk=0;i=X-1;j=Y-1\nwhile i>=0 and j>=0 and k<C:\n if min((pm[i]-rm[k]),(qm[j]-rm[k])) < 0 :\n if pm[i]>=qm[j] :\n qm[j]=rm[k]\n j=j-1\n elif pm[i]<qm[j]:\n pm[i]=rm[k]\n i=i-1\n else:\n\n elif min((pm[i]-rm[k]),(qm[j]-rm[k])) > 0:\n break\n k=k+1\n\nans=sum(pm[:X])+sum(qm[:Y])\nprint(ans)\n', '# -*- coding: utf-8 -*-\n\ndef mergef(a,b):\n c = []\n h = j = 0\n while j<len(a) and h<len(b):\n if a[j]>b[h]:\n c.append(a[j])\n j+=1\n else:\n c.append(b[h])\n h+=1\n if j==len(a):\n for i in b[h:]:\n c.append(i)\n else:\n for i in a[j:]:\n c.append(i)\n return c\n\ndef merge_sortf(lists):\n if len(lists) <= 1:\n return lists\n middle = int(len(lists)/2)\n left = merge_sortf(lists[:middle])\n right = merge_sortf(lists[middle:])\n return mergef(left,right)\n\n\nX,Y,A,B,C= map(int,input().split())\np = list(map(int,input().split()))\nq = list(map(int,input().split()))\nr = list(map(int,input().split()))\n\npm=merge_sortf(p)\nqm=merge_sortf(q)\nrm=merge_sortf(r)\n\nk=0;i=X-1;j=Y-1\nwhile i>=0 and j>=0 and k<C:\n if min((pm[i]-rm[k]),(qm[j]-rm[k])) < 0 :\n if pm[i]>=qm[j] :\n qm[j]=rm[k]\n if j>0:\n j=j-1\n elif pm[i]<qm[j]:\n pm[i]=rm[k]\n if i>0:\n i=i-1\n elif min((pm[i]-rm[k]),(qm[j]-rm[k])) > 0:\n break\n k=k+1\n\nans=sum(pm[:X])+sum(qm[:Y])\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s812717243', 's578817484']
[3064.0, 22720.0]
[17.0, 1968.0]
[1123, 1156]
p02727
u617718239
2,000
1,048,576
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively. From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible. Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.
['x, y, a, b, c = map(int, input().split())\narrayP = list(map(int, input().split()))\narrayQ = list(map(int, input().split()))\narrayR = list(map(int, input().split()))\narrayP.sort(reverse=True)\narrayQ.sort(reverse=True)\narrayR.sort(reverse=True)\narrayAns = []\nfor i in range(x):\n arrayAns.append(int(arrayP[i]))\nfor i in range(y):\n arrayAns.append(int(arrayQ[i]))\narrayAns.sort()\nfor i in range(min(len(arrayR), len(arrayAns)):\n if arrayAns[i] <= int(arrayR[i]):\n arrayAns[i] = int(arrayR[i])\n else:\n break\nprint(sum(arrayAns))\n', 'x, y, a, b, c = map(int, input().split())\narrayP = list(map(int, input().split()))\narrayQ = list(map(int, input().split()))\narrayR = list(map(int, input().split()))\narrayP.sort(reverse=True)\narrayQ.sort(reverse=True)\narrayR.sort(reverse=True)\narrayAns = []\nfor i in range(x):\n arrayAns.append(int(arrayP[i]))\nfor i in range(y):\n arrayAns.append(int(arrayQ[i]))\narrayAns.sort()\nfor i in range(min(len(arrayR), len(arrayAns))):\n if arrayAns[i] <= int(arrayR[i]):\n arrayAns[i] = int(arrayR[i])\n else:\n break\nprint(sum(arrayAns))\n']
['Runtime Error', 'Accepted']
['s243301589', 's973475806']
[3064.0, 23328.0]
[18.0, 317.0]
[551, 552]