Solve ABC160-E in Python

Introduction

I want to be able to solve the green diff, so I will solve the green diff that seems to be solvable.

Red and Green Apples

Red apples eat up to $ X $ and green apples eat up to $ Y $, so you only eat $ X, Y $ before you sort $ p, q $ in descending order. .. Colorless apples can be in both colors, so connect $ p [: X], q [: Y], r $ and arrange them in descending order. The answer is the sum from the front of the concatenated list to $ X + Y $. Also, the sort for Python list is $ O (N log N) $, so it's tolerable.

x, y, a, b, c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
p = p[:x]
q = q[:y]
apple = p + q + r
apple.sort(reverse=True)
ans = sum(apple[:x+y])
print(ans)

Summary

I want to be green. see you.

Recommended Posts

Solve ABC160-E in Python
Solve ABC146-C in Python
Solve ABC098-C in Python
Solve ABC159-D in Python
Solve Wooldridge exercises in Python
Solve ABC175 D in Python
Solve optimization problems in Python
Solve Atcoder ABC169 A-D in Python
Solve ABC036 A ~ C in Python
Solve ABC037 A ~ C in Python
Solve ordinary differential equations in Python
Quadtree in Python --2
Python in optimization
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
SendKeys in Python
Meta-analysis in Python
Unittest in python
Epoch in Python
Discord in Python
Sudoku in Python
nCr in python
N-Gram in Python
Programming in python
Plink in Python
Lifegame in Python.
FizzBuzz in Python
Sqlite in python
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
Constant in python
nCr in Python.
format in python
Scons in Python3
Puyo Puyo in python
python in virtualenv
PPAP in Python
Quad-tree in Python
Reflection in Python
Chemistry in Python
Hashable in python
DirectLiNGAM in Python
LiNGAM in Python
Flatten in python
flatten in python
ABC 157 D --Solve Friend Suggestions in Python!
I wanted to solve ABC159 in Python
Solve ABC165 A, B, D in Python
Solve the maximum subarray problem in Python
Sorted list in Python
Daily AtCoder # 36 in Python
Daily AtCoder # 2 in Python
Implement Enigma in python
Daily AtCoder # 32 in Python
Daily AtCoder # 18 in Python
Singleton pattern in Python
File operations in Python
Key input in Python