Sergey vs Teachassist

View as PDF

Submit solution

Points: 7 (partial)
Time limit: 1.5s
Memory limit: 64M

Author:
Problem type

When he isn't asserting his dominance with chess skills, Serog1sPerog1s can be found staring at his computer while frantically reloading TeachAssist. Because of this, he never has time to do his chemistry homework and now his mark has plummeted.

Fortunately his teacher Mr. Bemistry has given him an opportunity to save his mark and his sanity. He offered to let him substitute some of his test marks for his corresponding project mark from the same unit. However, he must make sure that he subs in no more than 2 projects from consecutive units. Mr. B also reminds him that each unit has a unique weighting in the course and that his marks are extremely accurate, down to 5 decimal places.

With his busy schedule of chess and reloading, Serog1sPerog1s is in panic has no time to figure out what to do. With a face as red as sriracha and tears flowing down like the Niagara, he begs you to tell him the fate of his precious mark.

Input Specification

The first line of the input will contain an integer N, representing the number of units in the course.

The second line will contain N floating point numbers W_i denoting the weighting of each unit i.

The third line will contain N floating point numbers T_i denoting the test percentage for each unit i.

The fourth line will contain N floating point numbers P_i denoting the project percentage for each unit i.

All decimal input can have up to 5 decimal places. The sum of W will always be 100.

Constraints

For all subtasks:

0 \le W_i, T_i, P_i, \le 100

Subtask 1 [30%]

1 \le N \le 10

Subtask 2 [70%]

1 \le N \le 10^5

Output Specification

The maximum mark he can get, rounded down to the nearest integer.

Sample Input

4
30.00000 20.00000 10.00000 40.00000 
90.00000 91.00000 92.00000 93.00000
94.00000 95.00000 96.00000 97.00000

Sample Output

95

Explanation

Serog1sPerog1s can switch to his first, second, and fourth project marks to get a mark of 94 * 30\% + 95 * 20\% + 92 * 10\% + 97 * 40\% , or 95.2%.


Comments