GlobeX Cup '19 J2 - Winnie Waifu Wars

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Winnie is playing the latest hot mobile game, AliensXBattle 2. In this game, Winnie has 6 aliens on the field. Each alien starts at level 1, but can be upgraded by using coins and alien drinks. The maximum level of each alien is 10. Each alien has a power level. The power level of each alien changes based on level. Help Winnie determine the maximum sum of power levels she can achieve.

Input Specification

The first line of input contains two integers N and M. N is the amount of coins Winnie has, and M is the amount of alien drinks Winnie has.

The second line of input contains two integers A and B. A is the amount of coins to level up an alien, and B is the amount of alien drinks needed to level up an alien.

Each of the next 6 lines of input contains 10 integers, X_{i,j}. X_{i,j} represents the power level of the i^\text{th} alien at level j. It is not guaranteed that an alien will increase their power level as they level up.

Output Specification

Output the maximum power level Winnie can achieve by upgrading her aliens.

Constraints

1 \le N,M,A,B \le 10^9
1 \le X_{i,j} \le 10^9

(Hint: What do these constraints tell you about the problem?)

Sample Input 1

1 1
1 1
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10

Sample Output 1

7

Comments

There are no comments at the moment.