Holi and Cultural Festival
Practice
5 (1 votes)
Algorithms
Graphs
Medium
Min Cost max_flow
Minimum cost maximum flow
Problem
27% Success 700 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

A cultural festival is going to be organized in Hacker Society on the day of Holi .The head of the society needs some Poets ,Dancers and some Musicians to perform in this event. He decides to interview N number of people who live in the society. Each one has ratings in all the three fields. He wants to choose right guys for the right job so that the festival can be celebrated in the best possible way.Thus he selects P Poets,D Dancers and M Musicians. Help him in organizing the event.

enter image description here

The strength of Cultural Festival is the sum of ratings of the people in the corresponding field. You have to maximize the sum of their ratings.

Input Format

First line contains 4 integers N,P,D,M.

Next 3 lines contain 3 arrays each of size N denoting the rating of the \(ith\) person in the corresponding field. The first one is the ratings of N people on their poetry skill, next on their dancing skill and the third one on their music skills.

Output Format

Print an integer denoting the maximum sum of ratings that can be obtained

Constraints

\( 1 \le N,P,D,M \le 2000 \)

\( 1 \le P+D+M \le N \)

\( 1 \le ratings \le 1000 \)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
62 votes
Tags:
ReadyBitmaskApprovedEasy
Points:30
1 votes
Tags:
AlgorithmsApprovedGraphsMediumNumber TheoryOpen
Points:30
2 votes
Tags:
AlgorithmsApprovedBinary SearchGraphsMediumOpenWeighted bipartite matching