Preparing NOJ

Company(easy)

1000ms 262144K

Description:

Recently, 0xfaner started a company.

The company has three divisions, which are in charge of different corporate affairs. But recently, department heads always reported to 0xfaner that they were understaffed.

So 0xfaner started the recruitment plan and successfully recruited $$$ x + y $$$ individuals.

Among them, department $$$ a $$$ needs $$$ x $$$ people and department $$$ b $$$ needs y people. Everyone shows different ability values in different departments.

0xfaner wants to know the sum of the maximum ability values that can be obtained by adjusting the allocation scheme.

Input:

The first line contains three integers $$$ x,y $$$ ( $$$ 0 < x,y,x+y \leq 10^5 $$$ ).

Each of the following $$$ x + y $$$ lines contains three integers $$$ a_i,b_i $$$ — the different ablilty value in dfferent department( $$$ 0 \leq a_i,b_i \leq 10^6 $$$ ).

Output:

Print a single integer — the maximum value 0xfaner can get.

Sample Input:

2 2
0 1
0 2
2 3
3 4

Sample Output:

8

Info

NOJ

Provider NOJ

Code NOJ2431

Tags

Submitted 39

Passed 8

AC Rate 20.51%

Date 12/04/2019 11:42:47

Related

Nothing Yet